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

Auto-postback RadGrid on change

5 Answers 703 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roger McCoy
Top achievements
Rank 1
Roger McCoy asked on 18 May 2010, 07:24 PM
Is there a way to get a RadGrid to postback updates when a combo box inside the grid is changed -- preferably without leaving edit mode in the process?

5 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 19 May 2010, 07:53 AM
Hello Roger,

It's possible - attached is a sample containing guidelines how to achieve this scenario.

Regards,
Tsvetoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Roger McCoy
Top achievements
Rank 1
answered on 20 May 2010, 02:49 PM
If I rebind the RadGrid in the ItemSelected function it seems that it doesn't save the changes; it only refreshes the page. Do I need to call an additional function?
0
Tsvetoslav
Telerik team
answered on 25 May 2010, 04:17 PM
Hi Roger,

Could you show how you perform the update and rebind the grid. Is it possible that you paste the whole mark-up and code-behind for the page containing the grid (please, use the code-formatter tool of the ticket editor to make the code-snippets readable).

Regards,
Tsvetoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Manav
Top achievements
Rank 1
answered on 19 Oct 2010, 10:08 PM
Hi,
Is there a way i can do the following: -
I am in the grid's add/edit mode. Based on the value selected in one of the Radcomboboxes in the grid, I need to show/hide or enable/disable another set of controls inside the grid.
Is this possible?
can you please show me how
0
Princy
Top achievements
Rank 2
answered on 20 Oct 2010, 05:53 AM
Hello Mark,

You can achieve this in 'OnSelectedIndexChanged' event of RadComboBox. In this event handler access the GridEditFormItem using NamingContainer property of RadComboBox. Then based on the selected value of RadCombobox disable the control. Sample code is given below.

ASPX:
<Columns>
   <telerik:GridBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" UniqueName="EmployeeID">
   </telerik:GridBoundColumn>
   <telerik:GridTemplateColumn>
     <EditItemTemplate>
      <telerik:RadComboBox ID="RadComboBox1" runat="server"
       DataSourceID="SqlDataSource1" DataTextField="FirstName" DataValueField="FirstName"
       AutoPostBack="True" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
      </telerik:RadComboBox>
     </EditItemTemplate>
   </telerik:GridTemplateColumn>
</Columns>

C#:
protected void RadComboBox1_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
   {
       RadComboBox combo = (RadComboBox)o;
       GridEditFormItem editItem = (GridEditFormItem)combo.NamingContainer; //if the grid is in edit mode
       TextBox txt = (TextBox)editItem["EmployeeID"].Controls[0];
       if (combo.SelectedValue == "David")
         txt.Enabled = false;
    }

Thanks,
Princy.
Tags
Grid
Asked by
Roger McCoy
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Roger McCoy
Top achievements
Rank 1
Manav
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or