This is a migrated thread and some comments may be shown as answers.

[Solved] Textbox in RadGrid postback

2 Answers 246 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Deb
Top achievements
Rank 1
Deb asked on 20 May 2008, 05:15 PM
Hi,

I've added a textbox to a RadGrid via a gridTemplateColumn.  Even though I've set the AutoPostBack of the textbox to false, every time I hit enter within the textbox, the page has a postback.  I'm trying to just capture the changes in javascript, and I don't want a postback to occur. If I just make a change and set focus on another column, the onchange javascript runs as expected.  The unwanted postback occurs with both the asp:TextBox and the RadTextbox.

Thanks for any assistance!

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 May 2008, 06:59 AM
Hi,

Can you try setting the AutoPostBack property of the TextBox to false in the code behind as shown below?

ASPX:
   <telerik:GridTemplateColumn UniqueName="TempCol" > 
                         <ItemTemplate> 
                             <asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox> 
                         </ItemTemplate> 
                        </telerik:GridTemplateColumn> 

CS:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
     { 
         if (e.Item is GridDataItem) 
         { 
             GridDataItem item = (GridDataItem)e.Item; 
             TextBox txtbx = (TextBox)item["TempCol"].FindControl("TextBox1"); 
             txtbx.AutoPostBack = false
         } 
    } 


Thanks
Shinu.

0
Deb
Top achievements
Rank 1
answered on 21 May 2008, 01:21 PM
Hi,

Thanks for your reply.  The scenario you've shown is similar to how I've written the code, and setting the textbox AutoPostBack property to false does not prevent the postback.  Also, I'm capturing the clientside ClientEvents-OnValueChanged and setting the EventArg._cancel = true to try and prevent the postback.  Again, doesn't help.

To me this seems like a bug...

Thanks for any help!

Tags
Grid
Asked by
Deb
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Deb
Top achievements
Rank 1
Share this question
or