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.
Hello,
You can achieve this using TemplatedDataField:
<ig:TemplateDataField Key="Name">
<ItemTemplate>
<a onclick="link()" href="#"><%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Name") %></a>
</ItemTemplate>
<Header Text="Name" />
</ig:TemplateDataField>
On click of the link you could open new window from BLOCKED SCRIPT
function link() {
window.open("Default2.aspx", "_blank");
}
Please let me know if this helps.
What if i need this hyperlink column to be in a child grid using manual on demand?
Can you give me an example of how I would then define the column in child grid?
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.
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.
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!
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.