Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
<asp:GridView ID="gvBillets" runat="server"  AutoGenerateColumns="false" OnRowDataBound="gvBillets_RowDataBound"  OnRowCommand="gvBillets_RowCommand"
                 DataKeyNames="BIN"  >
                    <Columns>
                        <asp:TemplateField HeaderText="Pri" ItemStyle-Width="20px" >
                            <ItemTemplate>
                               <asp:TextBox ID="tbPref" runat="server"  Width="20px" style="text-align:center" Text='<%# Eval("Preference") %>'   OnTextChanged="tbPref_TextChanged" AutoPostBack='true' ></asp:TextBox>
                                <itemstyle horizontalalign="Center"></itemstyle>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField ItemStyle-Width="40%" HeaderText="Details">
                            <ItemTemplate>
                                <a id="A3"  önclick="javascript:OpenBilletDetailsDialog('<%# Eval("bin") %>'); return false;"
                                    href=#>
Posted 22-Feb-13 14:24pm
Comments
Tadit Dash at 23-Feb-13 3:27am
   
Your codes are not posted correctly. Please Improve.
Member 9782903 at 23-Feb-13 12:06pm
   
I have resubmitted code. OnTextChanged Event does not fire. Have a break point but it is never reached.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Issue was with the page load event. Added if(!Page.IsPostBack) for page load event which allowed Text Changed event to fire.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Here is repost of code.  tbPref_textchangedevent does not fire....
 
 <asp:gridview id="gvBillets" runat="server" autogeneratecolumns="false" onrowdatabound="gvBillets_RowDataBound" onrowcommand="gvBillets_RowCommand" xmlns:asp="#unknown">
                 DataKeyNames="BIN"  >
                    <columns>
                        <asp:templatefield headertext="Pri" itemstyle-width="20px">
                            <itemtemplate>
                               <asp:textbox id="tbPref" runat="server" width="20px" style="text-align:center" text="<%# Eval("Preference") %>" ontextchanged="tbPref_TextChanged" autopostback="true"></asp:textbox>
                                <itemstyle horizontalalign="Center"></itemstyle>
                            </itemtemplate>
                        </asp:templatefield>
                        <asp:templatefield itemstyle-width="40%" headertext="Details">
                            <itemtemplate>
                                <a id="A3" onclick="javascript:OpenBilletDetailsDialog('<%# Eval(" bin=") %>'); return false;">
                                    href=#><%# Eval("billet_name") %></a>
                            </itemtemplate>
                        </asp:templatefield>
                        <asp:boundfield itemstyle-width="40%" headertext="Unit Name" readonly="true" datafield="unit_name" />
                        <asp:boundfield itemstyle-width="5%" headertext="RBSC" readonly="true" datafield="rbsc" />
                        <asp:boundfield itemstyle-width="5%" headertext="Desig" readonly="true" datafield="desig" />
                        <asp:boundfield itemstyle-width="5%" headertext="Rank" readonly="true" datafield="rank_desc" />
                        <asp:buttonfield buttontype="Link" commandname="Remove" itemstyle-horizontalalign="Center" itemstyle-cssclass="linkoff" headertext="Remove" text="X" />
                        <asp:boundfield datafield="BIN" visible="false" readonly="true" />
                       
                       
                    </columns>
                </asp:gridview>
 
Here is code behind which does not fire.
 
   protected void tbPref_TextChanged(object sender, EventArgs e)
        {
            GridViewRow row = ((GridViewRow)((TextBox)sender).NamingContainer);
            TextBox Pri = (TextBox)row.FindControl("tbPref");
            //code to go here when pri is changed
 

 
  Permalink  
Comments
ProgramFOX at 23-Feb-13 12:07pm
   
You can improve your question using the "Improve question" button.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

hi !!!!! Check this link
 
TextBox Change Event Inside GridView[^]
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 319
1 OriginalGriff 280
2 Sergey Alexandrovich Kryukov 250
3 Peter Leow 171
4 Abhinav S 168
0 Sergey Alexandrovich Kryukov 8,944
1 OriginalGriff 5,280
2 Peter Leow 3,985
3 Maciej Los 3,535
4 Abhinav S 3,218


Advertise | Privacy | Mobile
Web02 | 2.8.140415.2 | Last Updated 23 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid