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

PopUp Edit Form Textbox Containing Null Text

1 Answer 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Francis
Top achievements
Rank 1
Francis asked on 17 May 2011, 03:34 PM
Greetings,
A while ago I quickly threw together a quick tool to manage our admin users and provide our support staff with the ability to reset users passwords.  It uses a RadGrid, bound to a collection of objects, and there is a GridTemplateColumn that holds an EditItemTemplate that has a textbox to collect the new password.  It used to work, and when we found the textbox in the ItemUpdated event handler, the textbox.text would be new password, and life would be good.  No longer though, now the text is always empty.  We recently updated our telerik controls to 2011.1.413.40, although this could have stopped working before then (it's a rarely used function apparently).  Below is the RadGrid definition and ItemUpdated Event handler.  If anyone has any ideas, that would rock.

<telerik:RadGrid ID="rgUsers" BorderColor="#cccccc" runat="server" AutoGenerateColumns="false"
     OnItemCommand="ItemCommand" OnUpdateCommand="ItemUpdated" AllowAutomaticUpdates="false">
     <MasterTableView DataKeyNames="adminuser_id" Width="100%" EnableViewState="false"
         EditMode="PopUp">
         <Columns>
             <telerik:GridBoundColumn DataField="email" HeaderText="Email Address" HeaderStyle-Width="25%"
                 ItemStyle-VerticalAlign="Top" ReadOnly="true" />
             <telerik:GridTemplateColumn HeaderText="Password" Visible="false" UniqueName="colPassword">
                 <EditItemTemplate>
                     <asp:TextBox ID="tbPassword" runat="server" MaxLength="30" />
                 </EditItemTemplate>
             </telerik:GridTemplateColumn>
             <telerik:GridEditCommandColumn ButtonType="LinkButton" ItemStyle-CssClass="gridaction" EditText="Reset Password" HeaderStyle-Width="15%" />
         </Columns>
     </MasterTableView>
     <ClientSettings>
         <Selecting AllowRowSelect="False" EnableDragToSelectRows="false" />
         <Scrolling AllowScroll="true" UseStaticHeaders="true" />
     </ClientSettings>
 </telerik:RadGrid>

protected void ItemUpdated( object sender, GridCommandEventArgs args )
{
    AdminUser user = args.Item.DataItem as AdminUser;
 
    TextBox tbPassword = args.Item.FindControl( "tbPassword" ) as TextBox;
 
    SqlExecutor.Execute( delegate( SqlConnection connection )
    {
        user.password = tbPassword.Text;
        user.Persist( connection );
    }, logger );
}

Thank you in advance if you have any ideas on this,
Francis

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 May 2011, 06:22 AM
Hello Francis,

I was unable to recreate the same at my end. I hope this code library will be helpful for making a double check.
Manual Insert/Update/Delete operations using Auto-generated editform with sql statements from the code-behind:

Thanks,
Shinu.
Tags
Grid
Asked by
Francis
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or