Asp: GridView text field always returns null

I added some text fields to gridview using the following code

<asp:TemplateField HeaderText="STD<br/>ID">
       <ItemStyle BackColor="LightBlue" />
          <ItemTemplate>
          <div style="font-size:xx-small; overflow:hidden;">
          <asp:TextBox ID="txtStandard" EnableViewState="true" Height="10" Font-Size="XX-Small" Width="50" Text='<%# bind("STANDARD_ID") %>' runat="server"></asp:TextBox>
       <asp:AutoCompleteExtender ID="AutoCompleteExtenderDemo" runat="server" 
            TargetControlID="txtStandard" ServiceMethod="GetCompletionList"
            MinimumPrefixLength="1" CompletionInterval="1000"
            EnableCaching="true" CompletionSetCount="20">
        </asp:AutoCompleteExtender>
                        </div>



                    </ItemTemplate>
                </asp:TemplateField>

I want to save updated values ​​to the database, but when I try to access the values ​​using

string strs = ((TextBox)TwoHeadedGridView1.Rows[0].FindControl("txtStandard")).Text;

It always returns me an empty value for all rows. The same thing happens for the dropdown list, it returns to me the initially selected value, i.e. the value selected during the input of the drop-down list does not have duplicate identifiers in my asp form, this is my first interaction with setting gridview, I want to somehow make it work,

Can someone suggest me some amendment ...

I checked that there is some kind of duplicate identifier in it,

+5
2

: http://www.eggheadcafe.com/software/aspnet/29602882/gridview--cant-get-text.aspx

, - !

GridView , Page_Load then , GridView. , , GridView , , , GridView.DataBind.

,, , Page_Load:

myGridView.DataSource = someDataSet;
  myGridView.DataBind();

, :

if (! IsPostBack)
{
myGridView.DataSource = someDataSet;
  myGridView.DataBind();
}

, VB.net, , , , #. , !

+4

? RowUpdated, . RowUpdating .

0

All Articles