Hi there,
I have a pretty simple search form as follows:
With C# in the back that looks like this:
If we choose a company from the list (blank zip field) and click search the results come back correct and the company name is persisted as the selected item, but if you just click search again without changing anything the combo box looses the selected item value and resets back to index 0.
I'm using an ObjectDataSource so why would this happen? I'm not manually calling DataBind for this RadComboBox anywhere?
Regards,
Jacques
I have a pretty simple search form as follows:
<
asp:Label
ID
=
"Label1"
AssociatedControlID
=
"ZipOrCityState"
runat
=
"server"
>Zip or City, State</
asp:Label
>
<
telerik:RadTextBox
ID
=
"RadTextBox1"
runat
=
"server"
EnableEmbeddedBaseStylesheet
=
"false"
EnableEmbeddedSkins
=
"false"
TabIndex
=
"1"
EnableSingleInputRendering
=
"true"
Width
=
"217px"
>
</
telerik:RadTextBox
>
<
asp:Label
ID
=
"Label2"
AssociatedControlID
=
"CompanyList"
runat
=
"server"
>Company</
asp:Label
>
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
EnableEmbeddedBaseStylesheet
=
"False"
EnableEmbeddedSkins
=
"False"
TabIndex
=
"2"
EnableSingleInputRendering
=
"true"
Width
=
"217px"
DataSourceID
=
"CompanyDataSource"
AllowCustomText
=
"false"
DataTextField
=
"CompanyName"
DataValueField
=
"CompanyId"
EnableViewState
=
"true"
>
</
telerik:RadComboBox
>
<
asp:ObjectDataSource
ID
=
"ObjectDataSource1"
runat
=
"server"
SelectMethod
=
"GetCompanyComboList"
TypeName
=
"Web.Offices.OfficeManager"
></
asp:ObjectDataSource
>
<
div
class
=
"officeSearchResultsButton"
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"Search"
CssClass
=
"blueButton"
OnClick
=
"Search_Click"
TabIndex
=
"25"
EnableEmbeddedBaseStylesheet
=
"false"
EnableEmbeddedSkins
=
"false"
ValidationGroup
=
"ValidOfficeSearch"
>
</
telerik:RadButton
>
</
div
>
With C# in the back that looks like this:
#region EVENTHANDLER - Page_Load
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
//Populate controls from values passed from calling page in the query string
ZipOrCityState.Text = Request.QueryString["zipOrCityState"];
CompanyList.SelectedValue = Request.QueryString["companyId"];
//Bind Offices Grid
OfficeGrid.DataBind();
}
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region EVENTHANDLER - Search_Click
protected void Search_Click(object sender, EventArgs e)
{
try
{
//Check if submitted data is valid
if (Page.IsValid)
{
//Bind Offices Grid
OfficeGrid.DataBind();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
throw ex;
}
}
#endregion
If we choose a company from the list (blank zip field) and click search the results come back correct and the company name is persisted as the selected item, but if you just click search again without changing anything the combo box looses the selected item value and resets back to index 0.
I'm using an ObjectDataSource so why would this happen? I'm not manually calling DataBind for this RadComboBox anywhere?
Regards,
Jacques