I am trying to get a link to display a div in a popup.
This my my link:
<li><a class="newAttachmentType" onclick="getFiles(true)">Move to somewhere</a></li>
and this is the div I am trying to call and put into a popup:
<div id="ddlFiles">
<label>
Select new CaseFile:</label>
<asp:DropDownList runat="server" ID="ddlCaseFilesNew" DataSourceID="dsCaseFiles"
DataTextField="Display" DataValueField="FileID" OnPreRender="ddl_PreRender" Width="300px" />
<label>
Select old CaseFile:</label>
<asp:DropDownList runat="server" ID="ddlCaseFilesOld" DataSourceID="dsCaseFiles"
DataTextField="Display" DataValueField="FileID" OnPreRender="ddl_PreRender" Width="300px" />
</div>
This is what I have tried so far in the “getFiles()”:
$('.newAttachmentType').click(function () {
$('#newAttachmentDialog').dialog({
autoOpen: true,
height: 'auto',
width: 'auto',
modal: true,
buttons: {
"Save": function () {
var attachmentName = $('#txtNewAttachmentName').val();
if (attachmentName != "") {
var res;
PageMethods.addNewAttachmentType(attachmentName, reloadAttachmentTypes, res);
$(this).dialog('close');
}
},
Cancel: function () {
$(this).dialog('close');
}
},
beforeClose: function () { $('#txtNewAttachmentName').val(''); }
});
});
You are assigning the click handler inside of your onclick method. Which is too late to have any effect.
Instead of assigning a click handler like that, just execute the code directly. Basically unwrap the inner function: