I have a page for creating occurrence, and it has a button that displays a popup to find the equipment and return the GUID and the name for the parent form.
But if I hide GUID column and not the stored value, as I do to get the GUID and set on the parent page even column being hidden in the gridview.
Follows the code I'm using
protected void GridViewEquipamento_RowCommand (object sender, and GridViewCommandEventArgs)
{
int rowIndex = Convert.ToInt32 (e.CommandArgument);
GridViewRow row = GridViewEquipamento.Rows [rowIndex];
string name = (row.FindControl ( "txtName") the TextBox) .Text;
string guid = GridViewEquipamento.Rows [rowIndex] .Cells [0] .Text;
Label1.Text = name;
Label2.Text = guid;
}
<Asp: GridView ID = "GridViewEquipamento" AutoGenerateColumns = "False" DataKeyNames = "new_equipamentosid"
CssClass = "table table-hover" runat = "server" AllowPaging = "True" DataSourceID = "SqlDataSource1" OnRowCommand = "GridViewEquipamento_RowCommand">
<Columns>
<Asp: BoundField DataField = "new_equipamentosid" InsertVisible = "true" Visible = "false" HeaderText = "Device ID" SortExpression = "new_equipamentosid" />
<Asp: TemplateField HeaderText = "Name" ItemStyle-WIDTH = "150">
<ItemTemplate>
<Asp: TextBox ID = "txtName" runat = "server" Text = '<% # Eval ( "new_nserie")%>' />
</ ItemTemplate>
</ Asp: TemplateField>
<Asp: ButtonField ButtonType = "Button" CommandName = "Select" Text = "Button" ImageUrl = "~ / Pictures / lookupOn.gif" />
</ Columns>
</ Asp: GridView>
<Asp: SqlDataSource ID = "SqlDataSource1" runat = "server" ConnectionString = "<% $ ConnectionStrings: PortalSolicitacoes.Properties.Settings.Setting%>"
SelectCommand = "select new_equipamentosid, new_nserie from new_equipamentos">
</ Asp: SqlDataSource>
Tank You