Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Submit an ASP.NET form in JQuery Facebox

Posted on 2008-10-21
4
Medium Priority
?
3,013 Views
Last Modified: 2012-05-05
I am pulling my hair out trying to find a way of normally submitting an ASP.NET form that is a JQuery FaceBox window and retreiving the information! Sounds like it should be simple but it isn't. I can put the form in the FaceBox window but once the form has been submitted I can't retreive the data.

Does anyone know a way to do this?

If nobody knows any way then is there any lightbox windows that support ASP.NET forms.
0
Comment
Question by:JimDestruct
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:sh0e
ID: 22770764
Can you post a demo?
Is the form being inserted into the DOM?

There is also one other thing, if you are using ASP.NET master pages, the id is generated by prepending names onto the id.  You will need to make use of Control.ClientID in your .aspx.cs code.
0
 
LVL 1

Author Comment

by:JimDestruct
ID: 22774351
Hiya, I have posted my current script below. Its not using a masterpage at the moment, it is just a single page I was using to try and get it to work properly. The form seems to submit with a LinkButton but I am unable to retreive the form values. If I however change the LinkButton to a Button then it doesnt submit at all!
    <form id="form1" runat="server">
    <div>
    
    <asp:HyperLink ID="HyperLink1" NavigateUrl="#showform" 
    runat="server" rel="facebox">Click Here</asp:HyperLink>
    
    <asp:Panel ID="Form" runat="server">
    
    
    <div id="showform" style="display:none;">
      
    <p><label>Name</label>
    <asp:TextBox ID="Name" runat="server"></asp:TextBox></p>
    
    <p><label>Company</label>
    <asp:TextBox ID="Company" runat="server"></asp:TextBox></p>
    
    <p><label>Phone</label>
    <asp:TextBox ID="Telephone" runat="server"></asp:TextBox></p>
    
    <p><label>Email</label>
    <asp:TextBox ID="Email" runat="server"></asp:TextBox></p>
    
    <p><asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Submit</asp:LinkButton>
    </p>
   
    </div>
    </asp:Panel>
    
    <asp:Panel ID="Thanks" runat="server" Visible="false"> 
    <asp:Literal ID="ThankYou" runat="server" />
    </asp:Panel>
    
    </div>
    </form>
 
 
 
 
 
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        char d = '"';
        string BuildList = "<script type=" + d + "text/javascript" + d + " language=" + d + "javascript" + d + ">";
        BuildList = BuildList + "jQuery.facebox('hello " + Name.Text + "')";
        BuildList = BuildList + "</script>";
        Thanks.Visible = true;
        ThankYou.Text = BuildList;
    }
}

Open in new window

0
 
LVL 16

Accepted Solution

by:
sh0e earned 2000 total points
ID: 22782834
The form has to be inserted into the facebox.  Right now all it is inserting is the inputs.

    <div>
    
    <asp:HyperLink ID="HyperLink1" NavigateUrl="#showform" 
    runat="server" rel="facebox">Click Here</asp:HyperLink>
    
    <asp:Panel ID="Form" runat="server">
    
    
    <div id="showform" style="display:none;">
          <form id="form1" runat="server">
    <p><label>Name</label>
    <asp:TextBox ID="Name" runat="server"></asp:TextBox></p>
    
    <p><label>Company</label>
    <asp:TextBox ID="Company" runat="server"></asp:TextBox></p>
    
    <p><label>Phone</label>
    <asp:TextBox ID="Telephone" runat="server"></asp:TextBox></p>
    
    <p><label>Email</label>
    <asp:TextBox ID="Email" runat="server"></asp:TextBox></p>
    
    <p><asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Submit</asp:LinkButton>
    </p>
   
    </div>
    </asp:Panel>
    
    <asp:Panel ID="Thanks" runat="server" Visible="false"> 
    <asp:Literal ID="ThankYou" runat="server" />
    </asp:Panel>
    
    </form>
    </div>
 
 
 
 
 
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        char d = '"';
        string BuildList = "<script type=" + d + "text/javascript" + d + " language=" + d + "javascript" + d + ">";
        BuildList = BuildList + "jQuery.facebox('hello " + Name.Text + "')";
        BuildList = BuildList + "</script>";
        Thanks.Visible = true;
        ThankYou.Text = BuildList;
    }
}

Open in new window

0
 
LVL 1

Author Closing Comment

by:JimDestruct
ID: 31508368
Nice one! I can stop tearing my hair out now :D
0

Featured Post

How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question