Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > ASP.NET Popup Fancy Box ต้องการส่งค่าจาก Parent Page ไปหน้า Popup



 

ASP.NET Popup Fancy Box ต้องการส่งค่าจาก Parent Page ไปหน้า Popup

 



Topic : 104721



โพสกระทู้ ( 61 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook Blogger



คือผมใช้ fancybox popup เพื่อเรียกไฟล์อีกหน้าไว้เป็นหน้าค้นหาหรือหน้า save data โดยเรียกเป็น iFrame ปัญหาคือ ผมต้องการส่งค่าจาก asp:DropDownList หรือ asp:TextBox ในหน้า parent page ไปหน้า popup ครับ

Code : parent page

Code : TestJqueryPopup.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestJqueryPopup.aspx.cs" Inherits="TestJqueryPopup" %> <!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"> <title>FancyBox 1.3.4 | Demonstration</title> <%--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>--%> <script src="Js/fancybox/jquery.min.js" type="text/javascript"></script> <script> !window.jQuery && document.write('<script src="Js/fancybox/jquery-1.4.3.min.js"><\/script>'); </script> <script src="Js/fancybox/jquery.mousewheel-3.0.4.pack.js" type="text/javascript"></script> <script src="Js/fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script> <link href="App_Themes/CSS/jqueryCSS/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" /> <link href="App_Themes/CSS/jqueryCSS/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $(document).ready(function() { /* * Examples - images */ $("a#example1").fancybox(); $("a#example2").fancybox({ 'overlayShow': false, 'transitionIn': 'elastic', 'transitionOut': 'elastic' }); $("a#example3").fancybox({ 'transitionIn': 'none', 'transitionOut': 'none' }); $("a#example4").fancybox({ 'opacity': true, 'overlayShow': false, 'transitionIn': 'elastic', 'transitionOut': 'none' }); $("a#example5").fancybox(); $("a#example6").fancybox({ 'titlePosition': 'outside', 'overlayColor': '#000', 'overlayOpacity': 0.9 }); $("a#example7").fancybox({ 'titlePosition': 'inside' }); $("a#example8").fancybox({ 'titlePosition': 'over' }); $("a[rel=example_group]").fancybox({ 'transitionIn': 'none', 'transitionOut': 'none', 'titlePosition': 'over', 'titleFormat': function(title, currentArray, currentIndex, currentOpts) { return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>'; } }); /* * Examples - various */ $("#various1").fancybox({ 'titlePosition': 'inside', 'transitionIn': 'none', 'transitionOut': 'none' }); $("#various2").fancybox(); $("#various3").fancybox({ 'width': '75%', 'height': '75%', 'autoScale': false, 'transitionIn': 'none', 'transitionOut': 'none', 'type': 'iframe' }); $("#various4").fancybox({ 'padding': 0, 'autoScale': false, 'transitionIn': 'none', 'transitionOut': 'none' }); }); </script> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <div id="content"> <h1> fancybox <span>v1.3.4</span></h1> <hr /> <p> Various examples </p> <ul> <li> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:DropDownList ID="DropDownList1" runat="server" onselectedindexchanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem Value="0">-- เลือกประเภทลูกค้า --</asp:ListItem> <asp:ListItem Value="1">นามบุคคล</asp:ListItem> <asp:ListItem Value="2">นามบริษัท</asp:ListItem> </asp:DropDownList> <asp:HyperLink ID="various3" runat="server" NavigateUrl="TestJqueryPopup_iFrame.aspx">เลือก</asp:HyperLink> <br /> ชื่อ-นามสกุล : <asp:TextBox ID="CusFname" runat="server" Width="23%" /> - <asp:TextBox ID="CusLname" runat="server" Width="50%" /> </ContentTemplate> </asp:UpdatePanel> </li> </ul> </div> </form> </body> </html>


Code : Popup page with Fancybox
Code : TestJqueryPopup_iFrame.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestJqueryPopup_iFrame.aspx.cs" Inherits="TestJqueryPopup_iFrame" %> <!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"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> ประเภทลูกค้า : <asp:Label ID="CusTypeName" runat="server" /> <asp:GridView ID="GridViewCustomer" runat="server" AutoGenerateColumns="False" BorderColor="#E7E7FF" CellPadding="3" BorderStyle="None" Width="80%" OnRowDataBound="GridViewCustomer_RowDataBound" HorizontalAlign="Center"> <RowStyle BackColor="#F5F5F5" ForeColor="#4A3C8C" /> <Columns> <asp:TemplateField HeaderText="ชื่อ-นามสกุล"> <ItemTemplate> <asp:Label ID="LblCusname" runat="server" Text="" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText=""> <ItemTemplate> <asp:Button ID="BtSelectCus" runat="server" Text="เลือก" CommandArgument='<%#Eval("CusID")%>' OnClick="BtSelectCus_Click" /> </ItemTemplate> <ItemStyle HorizontalAlign="Center" /> </asp:TemplateField> </Columns> <AlternatingRowStyle BackColor="#ecf5ff" ForeColor="#4A3C8C" /> </asp:GridView> </div> </form> </body> </html>


อยากทราบวิธีส่งค่า <asp:DropDownList ID="DropDownList1" > จากหน้า parent page ไปแสดงหน้า Popup page Fancybox ที่ <asp:TextBox ID="TextBox1" runat="server"> ด้วยการกดจาก <asp:HyperLink> หรือ <asp:Button> ก็ได้ครับ



Tag : .NET, Ms SQL Server 2008, jQuery, Web (ASP.NET), VS 2008 (.NET 3.x)







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2014-01-17 17:00:05 By : karn4851 View : 1660 Reply : 2
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ใช้ Code นี้ครับ

parent.document.frmMain.txtServiceID.value='xyz';







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-01-18 09:03:34 By : mr.win
 


 

No. 2



โพสกระทู้ ( 61 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook Blogger

ตอบความคิดเห็นที่ : 1 เขียนโดย : mr.win เมื่อวันที่ 2014-01-18 09:03:34
รายละเอียดของการตอบ ::

นำโค้ตนี้ใส่ที่ส่วนไหนครับ หน้า Parent หรือหน้า Popup ครับ คือผมลองใช้เรียกข้อมูลของ Dropdown แบบนี้ครับ

$("#various3").fancybox({ 'width': '75%', 'height': '75%', 'autoScale': false, 'transitionIn': 'none', 'transitionOut': 'none', 'href' : 'TestJqueryPopup_iFrame.aspx?CusType=' + parent.document.form1.DropDownList1.value, 'type': 'iframe' });


ผมเปลี่ยนเป็นแบบนี้ครับถึงเรียกได้
$("#various3").fancybox({ 'width': '75%', 'height': '75%', 'autoScale': false, 'transitionIn': 'none', 'transitionOut': 'none', 'href' : 'TestJqueryPopup_iFrame.aspx?CusType=' + document.getElementById('<%= DropDownList1.ClientID %>').value, 'type': 'iframe' });


ปัญหาหลังจากเรียกได้คือ ถ้าเลือก dropdownlist แล้วไม่มีการ postback มันก็จะไม่รัน script ให้ครับ ผมเลยต้องใส่ function ครอบไว้และเรียกใช้ function แบบนี้ครับ

<script type="text/javascript"> function getPop() { $(document).ready(function() { }); } </script> <asp:DropDownList ID="DropDownList1" runat="server" onchange="getPop();" >


วิธีที่ผมทำนี้ถูกมั้ยครับ หรือมีวิธีที่ง่ายกว่านี้ ขอคำแนะนำด้วยครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-01-21 08:52:50 By : karn4851
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ASP.NET Popup Fancy Box ต้องการส่งค่าจาก Parent Page ไปหน้า Popup
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่