srijeda, 23. rujna 2009.

How to retain the Values for GridView in Templatecontrol

example:
asp :
In GridView : OnSelectedIndexChanged = "GridView_Species_SelectedIndexChanged"
In ItemTemplate: Use Label with id = "lblGenus_Item"

codebehind:
In GridView_Species_SelectedIndexChanged

// Get the currently selected row using the SelectedRow property.
GridViewRow row = GridView_Species.SelectedRow;
//sve value from label to the string
string genus = ((Label)row.Cells[2].FindControl("lblGenus_Item")).Text;