We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get selected value from EditItemTemplate-Dropdown?

Thread ID:

Created:

Updated:

Platform:

Replies:

72837 Apr 8,2008 07:37 AM Apr 10,2008 01:30 AM ASP.NET Web Forms (Classic) 1
loading
Tags: GridGroupingControl
Najir
Asked On April 8, 2008 07:37 AM

Hi

WhWe have added a dropdown dynamically as in the code below. How do we get the value the user has selected in the drop down when the chenges are saved?

protected void GridControl_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
if (e.TableCellIdentity.Column.Name == ChecklistItemTableColumns.DepartmentID)
{
DropDownList departmentDropDown = new DropDownList();
departmentDropDown.ID = "m_DepartmentDropDown" + checklistItemID.ToString();
departmentDropDown.DataSource = GetDepartmentDataTable();
departmentDropDown.DataTextField = Department_LVTableColumns.DepartmentName;
departmentDropDown.DataValueField = Department_LVTableColumns.DepartmentID;
departmentDropDown.DataBind();
departmentDropDown.SelectedValue = e.Style.CellValue.ToString();
departmentDropDown.AutoPostBack = false;

TemplateClass editItemTemplate = new TemplateClass(departmentDropDown);
e.TableCellIdentity.Column.EditItemTemplate = editItemTemplate;
}


}


Janagan [Syncfusion]
Replied On April 10, 2008 01:30 AM

Hi Najir,

Thanks for your interest in Syncfusion products.

You can retrieve the values of the dropdown list in edit mode, by the following code below:



protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = sender as DropDownList;
Record rd = GridGroupingControl1.Table.CurrentRecord;

rd.SetValue("City", ddl.SelectedItem.Value);

}



Please refer the sample in the link below which illustrates the above:

http://www.syncfusion.com/support/user/uploads/dropdown_fd5cf997.zip

Please try running the sample and let me know if this helps.

Regards,
Janagan.





CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;