Disabling either Save Button or Entire Control on page load (idealy server side))

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    7 posts
    Member since:
    Feb 2014

    Posted 01 Apr 2014 Link to this post

    Attached is an example (with sensitive data removed).

    We want to simply disable it the quickest way possible when a page loads.

    If that means simply disabling the save button that would be enough.

    A lot of examples here involve javascript.  If possible we want to avoid javascript for security reasons and use a server side solution.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Apr 2014 in reply to Kevin Link to this post

    Hi Kevin,

    Please have a look into the sample code snippet which works fine at my end.

    <telerik:RadButton ID="RadButton1" runat="server" Text="Save">
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="false" OnItemDataBound="RadGrid1_ItemDataBound">
                <telerik:GridBoundColumn DataField="OrderID" UniqueName="OrderID">
                <telerik:GridBoundColumn DataField="CustomerID" UniqueName="CustomerID">
                        <telerik:RadTextBox ID="RadTextBox1" runat="server">

    protected void Page_Load(object sender, EventArgs e)
        foreach (var controls in form1.Controls.OfType<Telerik.Web.UI.RadButton>())
            //disable save button
            controls.Enabled = false;
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        if (e.Item is GridDataItem)
            //disable controls inside the grid
            GridDataItem item = (GridDataItem)e.Item;
            RadTextBox textBox = (RadTextBox)item.FindControl("RadTextBox1");
            textBox.Enabled = false;

Back to Top