I have a grid with a template form for editing. I initially load my controls on the item data bound event but would like to also postback and update a series of dropdowns before the final insert or update. My problem is that when I postback from the RadComboBox I can not seem to get access to the container to update the other dropdown. If I, as an option, create a custom command and use ItemCommand I am unable to see the GridDataItem.IsInEditMode as true nor cast to a GridEditFormItem to access these other fields. BTW if the command is one of the core CRUD commands like update or insert I have no problem with accessing these fields.
Ideally I'd like to just autopost the dropdowns to update but I can live with a button if I can get that to work.
Hope all that makes sense. Any ideas? Thanks.
Sample code
aspx:
Thanks in advance.
Ideally I'd like to just autopost the dropdowns to update but I can live with a button if I can get that to work.
Hope all that makes sense. Any ideas? Thanks.
Sample code
aspx:
<EditFormSettings EditFormType="Template" > |
<FormTemplate> |
<asp:Panel ID="Panel1" runat="server" DefaultButton="btnUpdate"> |
... |
<asp:Button ID="btnTest" Text="Test" runat="server" CausesValidation="False" CommandName="InterimUpdate"></asp:Button> |
</asp:Panel> |
</FormTemplate> |
</EditFormSettings> |
protected void rg_ItemCommand(object source, Telerik.WebControls.GridCommandEventArgs e) |
{ |
if (e.CommandName == "InterimUpdate") <== simple embeded command button see above |
{ |
if (e.Item is GridEditFormItem && e.Item.IsInEditMode) <== Never gets past this on custom command |
{ |
string s = ((RadComboBox)e.Item.FindControl("rcb1")).SelectedValue; |
RadComboBox rcb = new RadComboBox(); |
rcb = e.Item.FindControl("rcb2") as RadComboBox; |
rcb.DataTextField = "Name"; |
rcb.DataValueField = "ID"; |
rcb.DataSource = getAllXXX(s); |
rcb.DataBind(); |
} |
} |
} |
Thanks in advance.