Hi dev_here,
I am attaching a sample, implementing your scenario. I used WebDialogWindow, but you could also use Response.Redirect method in RowSelectionChanged event to navigate to a new page.
Let me know if you have any questions regarding the matter.
If you need any further assistance with the matter please do not hesitate to ask.
You could create a TemplatedDataField in the child grid like in the RowIslandPopulating event handler like this:
TemplateDataField col = new TemplateDataField();col.ItemTemplate = new ActionChildItemTemplate();col.Key = "TemplatedColumn";
And here is sample ActionChildItemTemplate class:
public class ActionChildItemTemplate : ITemplate{
#region ITemplate Member
public void InstantiateIn(Control container) { HyperLink link = new HyperLink(); link.ID = "link"; link.ForeColor = Color.Blue; container.Controls.Add(link); }
#endregion
}
Hope this helps.
Ok that works but how do i get the text to show up in the column?
For example the code in .aspx
<asp:HyperLink ID="link" runat="server" ForeColor="blue" Text='<% #DataBinder.Eval(Container,"DataItem.Name") %>'>
</asp:HyperLink>
How can i change it to code behind:
link.Text=DataBinder.Eval(Container,"DataItem.Name")?????
It should look something similar to:
link.Text = ((DataRowView)(((TemplateContainer)container).DataItem)).Row["Name"].ToString();
Let me know if this works for you.
This works..but if i have beaviors enabled then if i sort it gives me an object reference error. I am adding the above said code to InitializeRow .
Is there a way to make behaviors work on child grid when you have hyperlinks in child grid?
It is not possible to sort templated columns. You could workaround this by having a hidden BoundDataField, containing the actual values from the templated field. Then on sorting the TemplateDataField, you apply the sorting to this hidden field instead. Here you can find more information and samples of this - http://ko.infragistics.com/community/forums/t/67075.aspx.
Hello dev_here,
Please refer to this thread - http://ko.infragistics.com/community/forums/p/74466/378293.aspx.
No i tried enabling viewstate and it doesnt help.i need to define the columns of child grid in the code.
Hello,
I would suggest you to try enabling viewstate or defining the template column in the markup.
Let me know if this helps.
Ok I can sort the column using the sample you provided. But after I sort once all the rows in that column disappear(the ones with the hyperlinks)Is this beacuse they are defined in InitializeRow?
Even if i disable sort on this column and enable sort on all other columns, this seems to happen the same way..Rows qith hyperlinks disappear..Please help!