Wednesday, March 21, 2012

ModalPopup - Dropdown List item change

I have a modal popup with a DDL on it. I want to capture what the new selected item and pass it to the server-side so I can process. How do I do this?

Thanks,

http://forums.asp.net/ShowPost.aspx?PostID=1379165

Thanks for the reply. Found the post you refer to, but it didn't fully answer my question. Exactly *how* does one code the client-side javascript to capture the DDL SelectedItem Change event?

The way the code is currently setup, it fires the server-side click event for the btnNoteSave button, and I can grab the content of the text boxes. You'll notice a hidden label field on the popup, i was hoping to use it to store the result of the selected item change from the dropdown.

The big question is, how do I do that?

Here is the code for the modal popup. THere is an ASCX control embedded in the note, Code for the ASCX is below.

 <asp:PanelID="pnlNewNote"runat="server"CssClass="modalPopup"Width="225px"><tablecellpadding="0"cellspacing="1"border="0"width="225px"class="tblSection">

<tr><tdcolspan="3"><uc1:NoteCtrlID="newNoteItem"runat="server"/></td></tr><trstyle="height:5px"><td></td></tr><tr><tdcolspan="3"style="text-align:center"><asp:ButtonID="btnNoteSave"runat="server"Text="Save"Width="50px"OnClick="btnNoteSave_Click"/><imgsrc="images/spacer.gif"style="width:15px"alt="space"/><asp:ButtonID="btnNoteCancel"runat="server"Text="Cancel"Width="50px"/></td></tr><trstyle="height:2px"><td></td></tr></table>

</

asp:Panel><cc1:ModalPopupExtenderID="newNotePopup"runat="server"TargetControlID="btnNewNote"DropShadow="true"PopupControlID="pnlNewNote"BackgroundCssClass="modalBackground"CancelControlID="btnNoteCancel"

/>

THE ASCX CONTROL:

<

tableborder="0"cellspacing="1"><tr><tdalign="right"><asp:LabelID="lblNoteDate"runat="server"Width="35px"CssClass="lblFormField">Date: </asp:Label></td><tdalign="left"><asp:TextBoxID="txtNoteDate"runat="server"Width="150px"CssClass="txtFormField"/></td></tr><tr><tdalign="right"><asp:LabelID="lblCallType"runat="server"CssClass="lblFormField">Call Type: </asp:Label></td><tdalign="left"><asp:DropDownListID="ddlCallTypes"runat="server"Width="155px"OnSelectedIndexChanged="ddlCallTypes_SelectedIndexChanged"/></td></tr><tr><tdalign="right"><asp:LabelID="lblUser"runat="server"CssClass="lblFormField">User: </asp:Label></td><td><asp:LabelID="lblUserData"runat="server"CssClass="txtFormField"/></td></tr><tr><tdcolspan="2"><asp:TextBoxID="txtNotes"runat="server"TextMode="MultiLine"Width="200px"Rows="5"CssClass="txtFormField"/></td></tr>

</

table>

<

divstyle="visibility:hidden"><asp:LabelID="lblCallTypeValue"runat="server"Text="Label"></asp:Label>

</

div>


The DropDownList.SelectedItemChanged event is a server-side event, not a client-side event.

No comments:

Post a Comment