DropDownList
-
in my .cs file when i write droplist.Attributes.Add("onclick", "return confirm('Do you wAnt to continue')"); the above is working but when i write droplist.Attributes.Add("onclick", "click()"); it doesnot what shud i do to solve the problem i have a function in cs file public void click() { }
-
in my .cs file when i write droplist.Attributes.Add("onclick", "return confirm('Do you wAnt to continue')"); the above is working but when i write droplist.Attributes.Add("onclick", "click()"); it doesnot what shud i do to solve the problem i have a function in cs file public void click() { }
droplist.Attributes.Add("onclick", "click()"); This line of code establishes that a javascript function named 'click()' will handle the javascript onclick event for your dropdownlist control. i have a function in cs file public void click() { } You are confusing client-side event handlers (typically written in Javascript, located in the ASPX page) with server-side event handlers (written in your preferred .NET language, located in the code-behind file). There's no server-side onclick event for the DropDownList control, so presumably you want to define a javascript method to execute in the client's browser. You can do this thus: function click() { // add implementation here } Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush