I have 3 columns, LID(item template column) ,LVal (Edit Item template column) and Edit link
My Question:
1) My EditITemTemplate column has a textbox txt_Lval which does not show up on the page load. But if click on edit link that particular row alone shows that edit item template column which has been invisible. I cannot see the column in design view itself. But if i change that to an Item template column it shows up in edit mode. I want to show it in edit mode only after user clicks Edit link
I have no idea what is going on with that invisible edit item template column which suddenly shows up during edit. The user should be able to see LVal column.
I am able to edit and update the row and insert the updated values back into DB.
Thank you for your help in Advance.
My grid details:-
Expand|Select|Wrap|Line Numbers
- <asp:GridView ID = "gvLv" runat = "server" AutoGenerateColumns = "False" DataKeyNames = "LID"
- CellPadding="4" ForeColor="#333333" GridLines="None" OnRowEditing = "gvLv_RowEditing" OnRowUpdating = "gvLv_RowUpdating" >
- <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
- <RowStyle BackColor="#EFF3FB" />
- <Columns>
- <asp:TemplateField HeaderText="LID" SortExpression="LID">
- <ItemTemplate>
- <asp:Label ID="lbl_Lid" runat="server" Text='<%# Bind("LID") %>'></asp:Label>
- </ItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Lval" Visible ="true" SortExpression="Lval">
- <EditItemTemplate>
- <asp:TextBox ID="txt_Lval" runat="server" Text='<%# Bind("LVAL") %>' Visible = "true"></asp:TextBox>
- </EditItemTemplate>
- </asp:TemplateField>
- <asp:CommandField ShowEditButton="True" />
- </Columns>
- <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
- <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
- <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
- <EditRowStyle BackColor="#2461BF" />
- <AlternatingRowStyle BackColor="White" />
- </asp:GridView>
Expand|Select|Wrap|Line Numbers
- Protected Sub gvLv_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles gvLv.RowCancelingEdit
- gvLv.EditIndex = -1
- LoadGrid()
- End Sub
- Protected Sub gvLv_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gvLv.RowEditing
- gvLv.EditIndex = e.NewEditIndex()
- LoadGrid()
- End Sub
- Protected Sub gvLv_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvLv.RowUpdating
- rowlid = CType(gvLv.Rows(e.RowIndex).FindControl("lbl_Lid"), Label).Text
- rowval = CType(gvLv.Rows(e.RowIndex).FindControl("txt_Lval"), TextBox).Text
- oCAD.UpdateList(CType(rowlid, Int32), rowval)
- LoadGrid()
- End Sub