问题描述
我需要在下拉列表中选择的索引更改事件中调用两个不同的函数。
我有ddl_SelectedIndexChanged事件。它将数据绑定到转发器。
现在我写了一个函数,用查询字符串重写页面的url。
我想要的是使用querystring参数填充该转发器。
我试过的是,首先将事件绑定到page_load中的ddl()
Hi,
I need to call two different functions on the dropdownlist's selected index change event.
I have ddl_SelectedIndexChanged event. which binds data to a repeater.
Now I wrote a function which rewrite the url of the page with query string.
What I want is to populate that repeater with the querystring parameter.
What I've tried is, first bind the event to ddl in page_load()
ddl.SelectedIndexChanged+=new EventHandler(ddl_SelectedIndexChanged);
和
and
if(!Page.IsPostBack)
{
<pre>ddl.Attributes.Add("onchange", "RedirectURL(); return true;");
}</pre>
如需参考
我有
For ref.
I am having
protected void ddlBrokerLocation_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlBrokerLocation.SelectedIndex > 0)
{
rptRepeater.DataSource = some table;
rptRepeater.DataBind();
}
}
您可以看到只有一个函数可能被调用。
在这种情况下,onchange被调用,因此转发器没有绑定。
是否有任何建议?
任何解决方法?
You can see only one function may get called.
In this case "onchange" got called and thus repeater not binded.
Any suggessions please?
Any workaround?
推荐答案
http://stackoverflow.com/questions/10861895/call-javascript-function-on-dropdownlist-selectedindexchanged-event
[]
这篇关于如何从Dropdownlist后面的c#代码中获取javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!