下拉选定的索引已更改 [英] drop down selected index changed
问题描述
我是新来的,但我试着解释一下。
< pre lang =c#>< embed src = / Programblade /<%:DropDownList1.SelectedValue.ToString( )%> width = 750 height = 550 >
它的工作原理非常好(因为我选择了一个默认的选项,但这是问题所在。
我希望它刷新那个区域,当selectedindexchanged,我尝试了很多,并搜索网络,但找不到我想要的东西。
< pre lang =c#> protected void DropDownList1_SelectedIndexChanged( object sender,EventArgs e)
{
什么我应该写在这里????刷新其他代码?
}
希望得到一些帮助:)
-Thanks
您应该使用Literal [ ^ ]然后只需将所需的embed标签输出到Text属性,并将Mode设置为PassThrough。 br />
这样的事情:
< asp:literal id = MyLit mode = PassThrough > < / asp:literal >
protected void DropDownList1_SelectedIndexChanged(< span class =code-keyword> object sender,EventArgs e)
{
if (!string.IsNullOrEmpty(DropDownList1) .SelectedValue){
myLit.Text = < embed src = \ < span class =code-string> / Programblade / \ dropdownlist1.selectedvalue = width = \750 \ height = \550 \ > < / embed > ;
}
}
请注意这是直接写入浏览器所以它可能不会编译。
问题解决了。
我没有检查解决问题的下拉列表中的AutoPostBack。
感谢您的兴趣,感谢您抽出宝贵时间。
Hi,
I am new at this, but i try to explain.
<embed src="/Programblade/<%: DropDownList1.SelectedValue.ToString() %>" width="750" height="550">
And it works really fine(because i have choosen an default selected item, but here is the problem.
I want it to refresh that area, when the selectedindexchanged, i tried a lot, and search the web, but could not find what i was looking for.
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
What should i write here???? to refresh the other code?
}
Hope for some help :)
-Thanks
Instead of writing out your embed tag and then inserting the actual file name you should look at using a Literal[^] and then just output the desired embed tag to the Text property and set the Mode to PassThrough.
So something like this:
<asp:literal id="MyLit" mode="PassThrough"></asp:literal>
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(DropDownList1.SelectedValue){ myLit.Text = "<embed src="\"/Programblade/\"" dropdownlist1.selectedvalue="" width="\"750\"" height="\"550\""></embed>"; } }
Please note this was written directly into the browser so it probably wont compile.
Problem solved.
I haven''t checked AutoPostBack on the dropdown that solved the problem.
Thanks for the interest and sorry for taking your time.
这篇关于下拉选定的索引已更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!