最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - DropDownList Client-side onchange stops Server-side SelectedIndexChanged event - Stack Overflow

programmeradmin0浏览0评论

How to call the clientside script and server-side script at same time. I cannot able to use both at same time.

<asp:DropDownList ID="ddlModule" runat="server" Width="200px" AutoPostBack="True"
                            OnSelectedIndexChanged="ddlModule_SelectedIndexChanged" />

In Page_Load

ddlModule.Attributes.Add("onchange", "javascript:return validateDropDown('" + ddlModule.ClientID + "');");

if client script execute then server side not working.

Please Help..

Thanks,

How to call the clientside script and server-side script at same time. I cannot able to use both at same time.

<asp:DropDownList ID="ddlModule" runat="server" Width="200px" AutoPostBack="True"
                            OnSelectedIndexChanged="ddlModule_SelectedIndexChanged" />

In Page_Load

ddlModule.Attributes.Add("onchange", "javascript:return validateDropDown('" + ddlModule.ClientID + "');");

if client script execute then server side not working.

Please Help..

Thanks,

Share Improve this question edited Jul 5, 2011 at 13:33 Muhammad Akhtar 52.2k37 gold badges139 silver badges191 bronze badges asked May 26, 2011 at 9:05 NavaneethanNavaneethan 2,2456 gold badges24 silver badges32 bronze badges 1
  • Adding an 'onchange' attribute to a dropdownlist doesn't seem to fire anything in the client side. Did I miss something? – Gezim Commented Jun 5, 2014 at 17:26
Add a ment  | 

1 Answer 1

Reset to default 3

One solution: in your validateDropDown JavaScript function you can postback the page

<script language='Javascript'>
__doPostBack('__Page', 'MyCustomArgument');
</script>

Here is a reference link How to call Postback from Javascript

发布评论

评论列表(0)

  1. 暂无评论