Hi,
I know this is probably a very simple scenario but I cannot work it out. I need to get the "Username" value from a GridTemplateColumn and place it into the ItemDataBound event in the code behind, here is the column:
| <telerik:GridTemplateColumn DataField="Username" |
| HeaderText="Username" |
| UniqueName="Username" |
| SortExpression="Username"> |
| <ItemTemplate> |
| <asp:Label ID="lblUsername" runat="server" Text='<%# Eval("Username") %>' /> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
And here is the code behind:
| protected void MembersGrid_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if ((e.Item is GridDataItem)) |
| { |
| GridDataItem dataItem = (GridDataItem)e.Item; |
| string username = dataItem["Username"].Text; |
| ImageButton btnEditUser = (ImageButton)e.Item.FindControl("EditUserImgBtn"); |
| btnEditUser.Attributes["href"] = "#"; |
| btnEditUser.Attributes["onclick"] = String.Format("return ShowEditUser('{0}', '{1}');", username, e.Item.ItemIndex); |
| } |
| } |
I need to get the value of the GridTemplateColumn ("Username") into the ShowEditUser('{0}', '{1}');", username, e.Item.ItemIndex), can someone please offer some advice this would be much appreciated.
Do I need to use a GridBoundColumn instead of the above? I don't think that would make any difference though.
Thank you in advance for help :)
