Hi,
I have 3 sets of controls. Each set has a Search button and two textboxes (IDNumber and Fullname). When the Search button is clicked, a modalpopupextender will come up. It contains a gridview containing a select button, the id number and full name of a user.
When the select button is clicked, it should transfer the id number and full name to the textboxes that are in the same set as to the Search button that trigged it.
I've disabled postback of the Search buttons and use javascript to show the modalpopupextender.
How can I make the modalpopupextender know which set called it and to transfer the selected data to?
laazsx
Member
277 Points
156 Posts
How to know which set to transfer data to
Apr 27, 2012 04:48 AM|LINK
Hi,
I have 3 sets of controls. Each set has a Search button and two textboxes (IDNumber and Fullname). When the Search button is clicked, a modalpopupextender will come up. It contains a gridview containing a select button, the id number and full name of a user. When the select button is clicked, it should transfer the id number and full name to the textboxes that are in the same set as to the Search button that trigged it.
I've disabled postback of the Search buttons and use javascript to show the modalpopupextender.
How can I make the modalpopupextender know which set called it and to transfer the selected data to?
Andrew
roopeshreddy
All-Star
20155 Points
3328 Posts
Re: How to know which set to transfer data to
Apr 27, 2012 04:58 AM|LINK
Hi,
Probably you need to pass the ModalPopupExtender control ID to the javascript function and pass the data accordingly!
Hope it helps u...
Roopesh Reddy C
Roopesh's Space
poojajoon
Member
228 Points
52 Posts
Re: How to know which set to transfer data to
Apr 27, 2012 05:04 AM|LINK
hey
Try this link it will help you.
http://www.codeproject.com/Articles/34996/ASP-NET-AJAX-Control-Toolkit-ModalPopupExtender-Co
asteranup
All-Star
30184 Points
4906 Posts
Re: How to know which set to transfer data to
Apr 27, 2012 06:51 AM|LINK
Hi,
Try this-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="How to know which set to transfer data to.aspx.cs" Inherits="How_to_know_which_set_to_transfer_data_to" %> <%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $("#search").click(showModalPopupViaClient); $(".selectidName").click(function () { current.find("input[id*=IDNumber]").val($(this).closest("tr").find("td:eq(0)").html()); current.find("input[id*=Fullname]").val($(this).closest("tr").find("td:eq(1)").html()); hideModalPopupViaClient(); }); }); var current = null; function showModalPopupViaClient() { current = $(this).closest("div"); var modalPopupBehavior = $find('programmaticModalPopupBehavior'); modalPopupBehavior.show(); } function hideModalPopupViaClient() { var modalPopupBehavior = $find('programmaticModalPopupBehavior'); modalPopupBehavior.hide(); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="Server" /> <div> <asp:TextBox ID="IDNumber" runat="server"></asp:TextBox> <asp:TextBox ID="Fullname" runat="server"></asp:TextBox> <input id="search" type="button" value="search" /> </div> </div> <ajaxToolkit:ModalPopupExtender runat="server" ID="programmaticModalPopup" BehaviorID="programmaticModalPopupBehavior" TargetControlID="hiddenTargetControlForModalPopup" PopupControlID="programmaticPopup" BackgroundCssClass="modalBackground" DropShadow="True" PopupDragHandleControlID="programmaticPopupDragHandle" RepositionMode="RepositionOnWindowScroll"> </ajaxToolkit:ModalPopupExtender> <asp:Button runat="server" ID="hiddenTargetControlForModalPopup" Style="display: none" /> <asp:Panel runat="server" CssClass="modalPopup" ID="programmaticPopup" Style="display: none; padding: 10px"> <asp:Panel runat="Server" ID="programmaticPopupDragHandle" Style="cursor: move; background-color: #DDDDDD; border: solid 1px Gray; color: Black; text-align: center;"> ModalPopup shown and hidden in code </asp:Panel> <asp:GridView ID="grid" runat="server" AutoGenerateColumns="False"> <Columns> <asp:TemplateField HeaderText="Id"> <ItemTemplate> <%# Eval("ID") %> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Name"> <ItemTemplate> <%# Eval("Name") %> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Name"> <ItemTemplate> <a href="#" class="selectidName">select</a> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </asp:Panel> </form> </body> </html>I think you should use jQuery dialog for popup.
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog