sagar Bhosale

sagar Bhosale

  • NA
  • 179
  • 176k

Textbox does not display in gridview on click of edit button

Jul 29 2011 5:19 AM
hi friends  i have following page . my problem is that when i click on edit does not display textbox within gridview
 <asp:GridView ID="gwdFolioScheme" runat="server" Width="100%" AutoGenerateColumns="false"
  OnRowEditing="gwdFolioScheme_RowEditing" OnRowUpdating="gwdFolioScheme_RowUpdating" OnRowCancelingEdit="gwdFolioScheme_RowCancelingEdit">
 
  <Columns>
 
  <asp:TemplateField HeaderStyle-CssClass="GridHeadCenter" ItemStyle-CssClass="GridDataCenter">
  <HeaderTemplate>Folio_Number</HeaderTemplate>
  <ItemTemplate>
  <%#Eval("Folio_Number")%>
  <%--  <%#DataBinder.Eval(Container.DataItem, "Folio_Number").ToString()%>--%>
  </ItemTemplate>
 
  <EditItemTemplate>
  <asp:TextBox ID="txtFolio_Number"  runat ="server" Text ='<%#Eval("Folio_Number")%>' CssClass="TextBox"></asp:TextBox>
  </EditItemTemplate>
 
 
  <ItemStyle Width="20%" />
  </asp:TemplateField>
 
  <asp:TemplateField HeaderStyle-CssClass="GridHeadCenter" ItemStyle-CssClass="GridDataCenter">
  <HeaderTemplate>AMC_CODE</HeaderTemplate>
  <ItemTemplate>
  <%#Eval("AMC_CODE")%>
  <%-- <%#DataBinder.Eval(Container.DataItem, "AMC_Code").ToString()%>--%>
  </ItemTemplate>
 
  <EditItemTemplate>
  <asp:TextBox ID="txtAMC_CODE"  runat ="server" Text ='<%#Eval("AMC_CODE")%>' CssClass="TextBox"></asp:TextBox>
  </EditItemTemplate>
 
 
 
  <ItemStyle Width="20%" />
  </asp:TemplateField>
 
  <asp:TemplateField HeaderStyle-CssClass="GridHeadLeft" ItemStyle-CssClass="GridDataLeft">
  <HeaderTemplate>Scheme Name</HeaderTemplate>
  <ItemTemplate>
 
  <%#Eval("S_Name")%>
 
  </ItemTemplate>
 
  <EditItemTemplate>
  <asp:TextBox ID="txtname"  runat ="server" Text ='<%#Eval("S_Name")%>' CssClass="TextBox"></asp:TextBox>
  </EditItemTemplate> 
   
  <ItemStyle Width="30%" />
 
  </asp:TemplateField>
 
 
  <asp:TemplateField HeaderStyle-CssClass="GridHeadCenter" ItemStyle-CssClass="GridDataCenter">
  <HeaderTemplate>Edit</HeaderTemplate>
  <ItemTemplate>
  <asp:LinkButton ID="btnEdit" CommandName="E" CommandArgument='<%# Eval("Client_Folio_ID") %>'
  runat="server">Edit</asp:LinkButton>
  </ItemTemplate>
  <ItemStyle Width="15%"/>
  </asp:TemplateField>
 
  <asp:TemplateField HeaderStyle-CssClass="GridHeadCenter" ItemStyle-CssClass="GridDataCenter">
  <HeaderTemplate>Delete</HeaderTemplate>
  <ItemTemplate>
  <asp:LinkButton ID="btnDelete" CommandName="D" CommandArgument='<%# Eval("Client_Folio_ID") %>'
  runat="server">Delete</asp:LinkButton>
  </ItemTemplate>
  <ItemStyle Width="15%"/>
  </asp:TemplateField>
 
  </Columns>
  </asp:GridView>


my .cs page
protected void gwdFolioScheme_RowEditing(object sender, GridViewEditEventArgs e) //when i debbuger set this line i it does not come on this line
  {
  gwdFolioScheme.EditIndex = e.NewEditIndex;
  gwdFolioScheme.DataBind();
  }

  protected void gwdFolioScheme_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
  {
  gwdFolioScheme.EditIndex = -1;
  gwdFolioScheme.DataBind();
  }


my problem is that why it is happen  when  i click edit button textbox does not display in gridview  .that is i need to edit

what is changes required in above code

plz help me

Answers (7)