Click here to Skip to main content
15,886,772 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

SQL
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();

           }
       }


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?
Posted
Comments
pradiprenushe 6-Aug-14 4:57am    
What is in RedirectURL?

Try This, On select change detect the value & Call that function in javascript if the postback is set to false. Otherwise ,you can use the code behind
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900