This code displays a Jquery dialog with an html textbox that is shown after the user clicks on an asp:button btnNewGroup
<script type="text/javascript" language="javascript">
function pageLoad(sender, args) {
var $dialog = $('<div><fieldset><label for="name">Name</label><input type="text" name="Name" id="name" class="text ui-widget-content ui-corner-all" /></div>')
.dialog({
modal: true,
autoOpen: false,
title: 'Enter New Group Name',
buttons: {
'New': function () {
$(this).dialog('close');
},
Cancel: function () {
$(this).dialog('close');
}
}
});
$("#<%=btnNewGroup.ClientID %>").click(function () {
$dialog.dialog('open');
return true;
});
}
</script>
<asp:Button ID="btnNewGroup" runat="server" Height="26px"
onclick="btnNewGroup_Click" Style="margin-bottom: 0px" Text="New Group"
ClientIDMode="Static" />
protected void btnNewGroup_Click(object sender, EventArgs e)
{
String t = Request.Form["Name"];
}
When the user clicks the new button in the dialogue I want to take the name from the textbox and use it in my code behinds asp new button click event.
I’m not really sure if this is what you are looking for but you coud pass the Name value to a Server side Web Method. by using Jquery’s Ajax with in the function for the New button.
On the server side in your code behind page you create a Web Method by adding a
to the top of your page and then creating a web method in your code behind like this
The Ajax call would replace the
That you currently have in your New Button click event with something like this.
}