0
autopost back이 true로 설정된 업데이트 패널 내에 asp 콤보 상자가 있습니다. 난 당신이 내가 DB.The 데이터에서 가져온 행 외에 2 개 여분의 행을 추가 한 볼 수있는 바와 같이 onselectedindexchanged
이벤트가Combobox 'OnSelectedIndexChanged'특정 값에 대해 실행되지 않습니다.
protected void productComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
string json = null;
List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
Dictionary<string, object> row = null;
var s = this.productComboBox.SelectedValue;
try
{
int totalNoOfItems = this.productComboBox.Items.Count;
// Make sure that Index are between "select a value" and "Other"
if (this.productComboBox.SelectedIndex > 0 && this.productComboBox.SelectedIndex < totalNoOfItems - 1)
{
//code here
}
json = new JavaScriptSerializer().Serialize(rows);
}
catch (Exception ex)
{
LogHandler.LogMessageToFile(ex, LogMode.Fatal);
}
}
을 바인더 제본이 또한
public DataTable getProductDetails()
{
MasterAllocationDB dataHandler = new MasterAllocationDB();
DataTable dataBoxType = null;
DataRow row = null;
try
{
dataBoxType = dataHandler.GetBoxType();
if (dataBoxType != null && dataBoxType.Rows.Count > 0)
{
row = dataBoxType.NewRow();
row["Product"] = "--Select--";
dataBoxType.Rows.InsertAt(row,0);
row = dataBoxType.NewRow();
row["Product"] = "Other";
dataBoxType.Rows.InsertAt(row, dataBoxType.Rows.Count);
}
}
catch (Exception ex)
{
LogHandler.LogMessageToFile(ex, LogMode.Fatal);
}
return dataBoxType;
}
으로 페이지로드
나는 콤보 상자를 채울 행이 올바르게 바인딩되어 출력 된 콤보 상자 값으로 표시됩니다.
실행 후 "기타"를 선택하면 콤보 상자의 텍스트가 변경 될 때마다 나타납니다.
을 "--select--"로 지정하면 제어가 절대 실행되지 않습니다. onselectedindexchanged
다른 모든 경우에는 미세하게 작동합니다. 그 이유는 무엇일까요?
'onselectindexchanged'에 대한 코드를 표시 할 수 있습니까? – sr28
@ sr28이 질문에 추가했습니다 –