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 dev_here,
You can get the value of column with key "ID" like this:
int id = Int32.Parse(e.CurrentSelectedRows[0].Items.FindItemByKey("ID").Text);
Feel free to contact me if you have any further questions.
I dont think I made myself very clear. I have 3 columns in my grid. Id, name and address. I want the name to be a clickable link which opens up a new window with some details. So how can i handle this . As in the example you provided I can click the entire row and it does not allow for a specific name to be the only one that can be clicked to open in a new window
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.
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.