开发者

DevExpress edit template combobox value to parameter

I have two pre populated combo boxes with value = “ID” and Text = Relevant data...

I am doing an edit in a grid view and I adjusted the template to have the two combo boxes (each relevant field has its own).

I have searched high and low and I assume this is so easy people don’t even ask about it... but if you see below the combo boxes do not populate the parameters with the value of the combo boxes.

So I have tried this:

    protected void aspxGridviewUsers_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        e.NewValues["StoreID"] = GetStoreID();
        e.NewValues["GroupID"] = GetGroupID();

    }
    protected int GetStoreID()
    {
        ASPxComboBox CBID = new ASPxComboBox();
        CBID = aspxGridviewUsers.FindEditFormTemplateControl("ASPxComboBoxStoreEdit") as ASPxComboBox;
        return Convert.ToInt32(CBID.SelectedItem.Value.ToString());
    }
    protected int GetGroupID()
    {
        ASPxComboBox CBID = new ASPxComboBox();
        CBID = aspxGridviewUsers.FindEditFormTemplateControl("ASPxComboBoxGroupEdit") as ASPxComboBox;
        return Convert.ToInt32(CBID.SelectedItem.Value.ToString());
    }

This did not work. What am I doing wrong here?

How can I use those values in th开发者_开发知识库e comboboxes to update against my update statement?


I would suggest that you use the following code:

return Convert.ToInt32(CBID.Value);

code. Does it work for you?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜