I have a page that's written using ASP.Net (C#)
I have a button that is NOT a server control but is just an anchor (
<a href="java<!-- no -->script:Add_Button_Click">Add</a>
).
The menu code looks like this:
<ul>
<li><a href="java<!-- no -->script:Add_Button_Click('someString');">Add Value To ASP.Net ListBox</a></li>
</ul>
The "Add_Button_Click" (JavaScript):
<script type="text/javascript">
function Add_Button_Click(someStringValue) {
}
</script>
The "Add_Button_Click" (C# Code Behind):
public static void Add_Button_Click(string someValue)
{
ListBox box = Page.FindControl("ListBox1") as ListBox;
}
In my page's Code Behind I need to be able to do two things:
1.) Call a C# function from the JavaScript code.
2.) In the C# function that's being called from JavaScript I need to add a ListBoxItem to an ASP.Net ListBox Server Control that resides on my page.
I've searched the web but can't seem to find a way to make any of these things work correctly.
Please show/tell me with example code how you guys would go about doing this, Thanks!!!