This is a migrated thread and some comments may be shown as answers.

How to Add an Attribute to the a tag of GridHyperLinkColumn?

4 Answers 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pooya
Top achievements
Rank 1
Pooya asked on 04 Jul 2011, 09:10 AM
I'm creating a GridHyperLinkColumn programattically.

I'd need to add an attribute of rel="shadowbox" to the <a> tag which is created by this control.

and I added this code:

protected override void RdGridItemCreated(object sender, GridItemEventArgs e)
        {
            base.RdGridItemCreated(sender, e);


            if (e.Item is GridDataItem)
            {
                // enable shadowbox
                var item = (GridDataItem) e.Item;
                var link = (HyperLink)item["Code"].Controls[0];
                link.Attributes.Add("rel", "shadowbox");
            }
        }

which adds the shadowbox rel element.

But shadowbox control doesn't work with it.

Is there any known issues between RadGrid and ShadowBox?

Many thanks

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Jul 2011, 11:22 AM
Hello Pooya,

Take a look at the following forum thread.
Shadowbox/Fancybox etc.

Thanks,
Shinu.
0
Pooya
Top achievements
Rank 1
answered on 04 Jul 2011, 11:46 AM
Thanks Shinu for your response.

I'm not using RadAjaxManager; I'm simply using UpdatePanel inside which I have my RadGrid added at runtime.

Also, I didn't find the "Shadowbox" in this list that are not supported: http://www.telerik.com/help/aspnet-ajax/ajax-3rdparty.html

In addition, I'm using ToolkitScriptManager rather than ScriptManager; (shouldn't make a difference)?



0
Pooya
Top achievements
Rank 1
answered on 04 Jul 2011, 04:00 PM
Would that be possible to use RadWindow with RadGridHyperLinkColumn so that when the link is clicked, a new RadWindow gets opened.

Achieving what could be achieved with shadowbox, with RadWindow?

If yes, how?

many thanks,
0
Pooya
Top achievements
Rank 1
answered on 04 Jul 2011, 04:45 PM
I fixed it :)

The reason was that the a controls were rendered after the ShadowBox.Init() was called so the solution was to run Shadowbox.Init() after the page rendering is finished using:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);

  function endRequestHandler(sender, args) {           
            Shadowbox.init();
        }

Hope it helps someone else.
Tags
Grid
Asked by
Pooya
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Pooya
Top achievements
Rank 1
Share this question
or