Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
EXT:C#组合框设置来自Codebehind的值_C#_Extjs_Combobox - Fatal编程技术网

EXT:C#组合框设置来自Codebehind的值

EXT:C#组合框设置来自Codebehind的值,c#,extjs,combobox,C#,Extjs,Combobox,我有这个组合框: <ext:ComboBox runat="server" ID="cmbEmailVer" FieldLabel="Email verification" Width="420" ForceSelection="true" EmptyText="Select a value..." OnDirectChange="cmbEmailVer_DirectChange" OnLoad="cmbEmailVer_Load" > <Items>

我有这个组合框:

<ext:ComboBox runat="server" ID="cmbEmailVer"  FieldLabel="Email verification"  Width="420" ForceSelection="true" EmptyText="Select a value..." OnDirectChange="cmbEmailVer_DirectChange" OnLoad="cmbEmailVer_Load" >
     <Items>
           <ext:ListItem Text="Yes" Value="1" />
           <ext:ListItem Text="No" Value="0" />
     </Items>
</ext:ComboBox>

但是,即使我可以通过断点看到它从codebehind设置了正确的值,应用程序中的组合框也不会改变

使用
SelectedIndex

if (em != null)
{
   string s = (em.login_verify_email ? 1 : 0).ToString();
   cmbEmailVer.SelectedIndex = cmbEmailVer.Items.IndexOf(s); 
}
else
{
   cmbEmailVer.SelectedIndex = cmbEmailVer.Items.IndexOf("1") 
}
if (em != null)
{
   string s = (em.login_verify_email ? 1 : 0).ToString();
   cmbEmailVer.SelectedIndex = cmbEmailVer.Items.IndexOf(s); 
}
else
{
   cmbEmailVer.SelectedIndex = cmbEmailVer.Items.IndexOf("1") 
}