问题描述
我有一个下拉值,称为“雇主”,“职位”和“部门”。 根据雇主选择的值,我正在更改其他两个的值。 例如,如果用户在Employerthen位置选择不可用,部门将自动选择为不可用。这工作正常。 还有另一件事是,如果我决定设置我的雇主值,一次在雇主中选择不可用之后,职位和部门值也将被清除。这也很好。
但是出现问题,当我用Ctrl + A选择Employer并通过退格键删除值并单击页面中下拉区域之外时,显示错误。
错误是 {“输入字符串的格式不正确。”}
在我的page_load事件中,我添加了它。
protected void Page_Load(object sender,EventArgs e)
{
try
{
if (ddlAddEmployer.Text == string.Empty)
{
ddlAddPosition.Text = "Select/type a position";
txtAddClinicalArea.Text = string.Empty;
txtLocationAddNumber.Text = string.Empty;
}
}
catch (Exception ex)
{
AddWorkHistoryRadAjaxPanel.Alert("An Error has occured");
((test.Global_asax)this.Context.ApplicationInstance).Application_Error(ex);
}
}
我还添加了 ddlAddEmployer_OnSelectedindexChanged 视图和CS文件
<telerik:RadComboBox ID="ddlAddEmployer" runat="server" name="ddlAddEmployer" AutopostBack="True" AllowCustomText="false"
EmptyMessage="Select a Company" EnableLoadondemand="true" OnClientBlur="OnClientBlurHandler"
Enablevirtualscrolling="true" DropDownAutoWidth="disabled" DropDownWidth="380px" OnSelectedindexChanged="ddlAddEmployer_OnSelectedindexChanged"
ShowMoreResultsBox="true" Skin="WebBlue" class="ddlAddEmployer" Width="250px">
<CollapseAnimation Duration="200" Type="OutQuint" />
<WebServiceSettings Method="PopulateradComboInstitutionWithVirtual" Path="AddWorkHistory.aspx" />
</telerik:RadComboBox>
cs文件:
protected void ddlAddEmployer_OnSelectedindexChanged(object sender,EventArgs e)
{
try
{
DataTable dtEmployer = InstitutionManager.GetInstitutionById(Convert.ToInt32(ddlAddEmployer.SelectedValue.ToString()));
if (dtEmployer != null && dtEmployer.Rows.Count > 0 && dtEmployer.Rows[0]["InstituteID"].ToString() != "" && dtEmployer.Rows[0]["InstituteName"].ToString() != "")
{
string institutionName = dtEmployer.Rows[0]["InstituteName"].ToString();
if (institutionName.Equals(Utility.NOTAVAILABLE))
{
DataTable dtPosition = PositionManager.GetPositionByName(institutionName);
if (dtPosition != null && dtPosition.Rows.Count > 0)
{
int positionId = Convert.ToInt32(dtPosition.Rows[0]["PositionID"].ToString());
string positionName = dtPosition.Rows[0]["PositionName"].ToString();
ddlAddPosition.Text = positionName;
ddlAddPosition.SelectedValue = positionId.ToString();
ddlAddPosition_OnSelectedindexChanged(ddlAddPosition,null);
}
}
else
{
ddlAddPosition.Text = "Select/type a position";
txtAddClinicalArea.Text = string.Empty;
txtLocationAddNumber.Text = string.Empty;
}
}
}
catch (Exception ex)
{
AddWorkHistoryRadAjaxPanel.Alert("An Error has occured");
((test.Global_asax)this.Context.ApplicationInstance).Application_Error(ex);
}
}
我很困惑。需要针对该问题的相关解决方案。 最好的问候,
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)