Hi,
How can i get the value of particular column in the particular row.In normal ASp gridview we can get the value by GridView.Rows(0).Cells(1).Value.ToString().Suppose i want to get the value of secondcolumn in firstrow of the child.IS dat using rowislands can we get that.?Please help me with this issue.
Regards,
Hsakarp
Hello Hsakarp,
You can get the text from the WHDG Child Column using the following code.
protected void WebHierarchicalDataGrid1_RowIslandDataBound(object sender, RowIslandEventArgs e) { ContainerGrid childGrid = this.WebHierarchicalDataGrid1.GridView.Rows[0].RowIslands[0];
string str= childGrid.Rows[0].Items[1].Text;
}
Please let me know if you have any further questions regarding this matter.
Hi Prabha,
When i tried the code am getting the exception :"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index".When i checked the IsrowIslands property it is showing as true.Even i tried with index value from 0 to 2.Please respond to this asap.
Hsakarp.
It is giving me the error as "Index was out of range. Must be non-negative and less than the size of the collection."
Please let me know if I can provide any further assistance regarding this matter.
I found that.
ContainerGrid childGrid = this.WebHierarchicalDataGrid2.GridView.Rows[0].RowIslands[0];
Textbox tb = (childGrid.Rows[0].items[2].FindControl("id") as TextBox);
string value = tb.text;
hsakarp.
I am trying to get the value from the template field in the child grid.am having a textbox in the third column of the child grid am trying to get the value from the textbox.I have tried with findcontrol property but it return as null.
In which event are you trying to access the value?
I suggest you to handler rowislandbound event.