Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ASP.NET
<div id="contact-popup" class="popup">
            <div class="popup-title">
                 <span></span>
            </div>
            <div class="popup-content">
                <div class="gridholder">
                    <div class="grid grid-5 gutr_n">
                        <div class="pl20">
                            
                            <p>
                                Please fill in the form below to contact us</p>
                            <div class="field">
                               <asp:TextBox ID="txtName" runat="server" CssClass="required input" Width="200px"></asp:TextBox>
                               <cc1:TextBoxWatermarkExtender ID="txtName_TextBoxWatermarkExtender"  runat="server"
                                Enabled="True" TargetControlID="txtName" WatermarkText="Full Name">
                               </cc1:TextBoxWatermarkExtender>
                                <%--<input type="text" name="name" id="name_field" value="Full Name*" class="required input"
                                    data-placeholder="Full Name*">--%>
                            </div>
                            <br />
                            <div class="field">
                               <asp:TextBox ID="txtEmail" runat="server" CssClass="required email input" Width="200px"></asp:TextBox>
                               <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1"  runat="server"
                                Enabled="True" TargetControlID="txtEmail" WatermarkText="Email Address">
                               </cc1:TextBoxWatermarkExtender>
                               
                                <%--<input type="text" name="email" id="Text1" value="Email*" class="required email input"
                                    data-placeholder="Email*">--%>
                            </div>
                            <br />
                            <div class="field">
                                <asp:TextBox ID="txtPhone" runat="server" CssClass="required input" Width="200px"></asp:TextBox>
                               <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2"  runat="server"
                                Enabled="True" TargetControlID="txtPhone" WatermarkText="Phone No">
                               </cc1:TextBoxWatermarkExtender>
                                <%--<input type="text" name="phone" id="Text2" value="Telephone*" class="required input"
                                    data-placeholder="Telephone*">--%>
                            </div>
                            <br />
                            <div class="field">
                                <asp:TextBox ID="txtCity" runat="server" CssClass="required input" Width="200px"></asp:TextBox>
                               <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender4"  runat="server"
                                Enabled="True" TargetControlID="txtCity" WatermarkText="City">
                               </cc1:TextBoxWatermarkExtender>
                                <%--<input type="text" name="title" id="Text3" value="Subject*" class="required input"
                                    data-placeholder="Subject*">--%>
                            </div>
                             <br />
                            <div class="field">
                                <asp:TextBox ID="txtAddress" runat="server" CssClass="required input" 
                                    Width="300px" Height="100px" TextMode="MultiLine"></asp:TextBox>
                               
                                <%--<textarea name="content" id="Textarea1" cols="30" rows="5" class="required input"
                                    data-placeholder="Message*"  runat="server">Message*</textarea>--%>
                            </div>
                            <br />
                            <div class="field">
                                <asp:TextBox ID="txtZipCOde" runat="server" CssClass="required input" 
                                    Width="200px"></asp:TextBox>
                               <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender5"  runat="server"
                                Enabled="True" TargetControlID="txtZipCOde" WatermarkText="ZIP Code">
                               </cc1:TextBoxWatermarkExtender>
                                <%--<textarea name="content" id="Textarea1" cols="30" rows="5" class="required input"
                                    data-placeholder="Message*">Message*</textarea>--%>
                            </div>
                            <br />  
                            <div class="field">
                                <asp:TextBox ID="txtCountry" runat="server" CssClass="required input" 
                                    Width="200px" data-placeholder="Message*"></asp:TextBox>
                               <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender6"  runat="server"
                                Enabled="True" TargetControlID="txtCountry" WatermarkText="Country">
                               </cc1:TextBoxWatermarkExtender>
                                <%--<textarea name="content" id="Textarea1" cols="30" rows="5" class="required input"
                                    data-placeholder="Message*">Message*</textarea>--%>
                            </div>
                            <br />
                            <div class="field">
                                <asp:TextBox ID="txtState" runat="server" CssClass="required input" 
                                    Width="200px" data-placeholder="Message*"></asp:TextBox>
                               <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender7"  runat="server"
                                Enabled="True" TargetControlID="txtState" WatermarkText="State">
                               </cc1:TextBoxWatermarkExtender>
                                <%--<textarea name="content" id="Textarea1" cols="30" rows="5" class="required input"
                                    data-placeholder="Message*">Message*</textarea>--%>
                            </div>
                            <br />
                            <div class="field">
                                <asp:Button ID="btnBuy" runat="server" Text="Buy Package" 
                                    CssClass="button small gray tupper fr mr80" onclick="btnBuy_Click" 
                                    UseSubmitBehavior="False"/>
                                <%--<button type="submit" class="button small gray tupper fr mr80">
                                    Submit</button>--%>
                            </div>
                            
                        </div>
                    </div>                    

                    <div class="grid grid-7">
                        <div class="bdl_d pl30 dotted-vertical-left">
                            <div id="map">
                            </div>
                            <div class="dotted pt10 mt10 mb10">
                            </div>
                            <div class="contact">
                                <h3 class="h-3 red dblock smaller">
                                    Packages</h3>
                                <p id="address">
                                    
                                </p>
                            </div>
                            <div class="contact">
                                <h3 class="h-3 red fl smaller">
                                    Tel:</h3>
                                <p id="phone">
                                </p>
                            </div>
                            <div class="contact">
                                <h3 class="h-3 red fl smaller">
                                    Fax:</h3>
                                <p id="fax">
                                     
                                </p>
                            </div>
                            <div class="contact">
                                <h3 class="h-3 red fl smaller">
                                    Email:</h3>
                                <p id="email">
                                </p>
                            </div>
                            <div class="pb40">
                            </div>
                        </div>
                    </div>
                    <div class="cf">
                    </div>
                </div>
            </div>
        </div>

        <script type="text/javascript">
        
    

    $(document).ready(function(){
        
        $('#contact-form .input').each(function() {
            $(this).blur(function() {
                if ($(this).val() == '') {
                    $(this).val($(this).attr('data-placeholder'));
                }
            });

            $(this).focus(function() {
                if ($(this).val() == $(this).attr('data-placeholder')) {
                    $(this).val('');
                }
            });
        });
        
        $('ul.contacts li a.contact').click(function() {

            var contact = $(this).parent().find('span.data');
            $('#phone').text(contact.attr('data-phone'));
            if (contact.attr('data-fax') == '') {
                $('#fax').parent().hide();
            } else {
                $('#fax').text(contact.attr('data-fax'));
                $('#fax').parent().show();
            }
            $('#address').html(contact.attr('data-address'));
            $('#email').text(contact.attr('data-email'));
            $('#contact-form #location').val(contact.attr('data-id'));
            $('#contact-popup .popup-title span').text(contact.attr('data-title'));
            $("#contact-popup").dialog( "open" );
            return false;
        });
        $('#contact-popup').dialog({
            modal: true,
            width:970,
            autoOpen:false,
            position:['center', 120],
            open: function(){
                var address = $('#address').html();
                var geocode_address = address.replace(/'/g,"");
                geocode_address = geocode_address.replace('<br>', ',');
                initializeMap(geocode_address);
                $('#name_field').blur();
            }
        });

        $.validator.messages.required = '';
        $('#contact-form').validate();

                var urlHashPart =  window.location.hash;

        /*
        if(urlHashPart) {

            var contactOpen = urlHashPart.substr(1);
            $('ul.contacts li a.contact[rel='+contactOpen+']').click();
        }
        */

        $('table td:nth-child(2) a,table td:nth-child(3) a,table td:nth-child(4) a').click(function(e){
            e.preventDefault();
            var link = $(this).attr('href');
            var explode = link.split('#');
            var country_id = explode[1];
            $('ul.contacts li a.contact[rel='+country_id+']').click();
        })
    });
 //$('input[placeholder], textarea[placeholder]').placeholder();

    /*
    $(window).bind('hashchange', function() {
        var urlHashPart =  window.location.hash;

        var contactOpen = urlHashPart.substr(1);
        $('ul.contacts li a.contact[rel='+contactOpen+']').click();
    });
    */

        </script>

        <script type="text/javascript">
    
    $('ul#news-list').carouFredSel({
            items   : {
                visible : 3
            },
            auto    : {
                delay   : 8000
            },
            scroll      : 1,
            direction   : 'down',
            next        : "#news-prev",
            prev        : "#news-next"
        });

        </script>





Also Code below
C#
protected void Page_Load(object sender, EventArgs e)
    {
        txtAddress.Focus();
        if (!Page.IsPostBack)
        {
            LoadAllPackage();            
        }        
    }
protected void btnBuy_Click(object sender, EventArgs e)
    {
        //ViewState["address"] = txtAddress.Text;        

        UserInformation entry = new UserInformation();

        TextBox tx = FindControl("txtAddress") as TextBox;
        entry.Address = ((TextBox)(FindControl("txtAddress"))).Text;
        entry.Address = tx.Text.Trim();
        entry.City = txtCity.Text.Trim();
        entry.Country = txtCountry.Text.Trim();
        entry.Email = txtEmail.Text.Trim();
        entry.Name = txtName.Text.Trim();
        entry.Mobile = txtPhone.Text.Trim();
        entry.State = txtPhone.Text.Trim();
        entry.ZIPCode = txtZipCOde.Text.Trim();

        ClsUserInformation.InsertUserInformation(entry);
    }
Posted
Updated 24-Apr-13 2:03am
v2
Comments
ZurdoDev 24-Apr-13 8:00am    
This is too much for me to filter through and try and figure out what you are talking about. Please only post the relevant code and be specific as to what your issue is.
Shahnawazcode 24-Apr-13 8:09am    
this a popup window i made.in poup window there are some textbox and button.but when i try to click on the button in the code behind it shows that like

txtAddress.Text="";
no data is found
ZurdoDev 24-Apr-13 8:13am    
Couple of things: Why are you using FindControl? txtAddress should be available to the class, right? Seconldy, you have set UseSubmitBehavior = false. Set it to true and see what happens.
Shahnawazcode 24-Apr-13 8:17am    
when i didn't get text then use FindControl. If I set UseSubmitBehavior =true then the button click event not fired... :-( plese see this side then i think its help you to help me.. :-)
http://anytimepcsupport.info/ServicePackageList.aspx
ZurdoDev 24-Apr-13 8:29am    
I wonder if you have something in your Page_Load that is not checking for IsPostBack that is causing it to get reset.

1 solution

Hi,

Add the following code

JavaScript
$("#contact-popup").parent().appendTo($("form:first"));


after the following function definition:

JavaScript
$('ul.contacts li a.contact').click(function () {
}



The fragment of code should look like the following:

JavaScript
....
$('ul.contacts li a.contact').click(function () {
                    var contact = $(this).parent().find('span.data');
                    $('#phone').text(contact.attr('data-phone'));
                    if (contact.attr('data-fax') == '') {
                        $('#fax').parent().hide();
                    } else {
                        $('#fax').text(contact.attr('data-fax'));
                        $('#fax').parent().show();
                    }
                    $('#address').html(contact.attr('data-address'));
                    $('#email').text(contact.attr('data-email'));
                    $('#contact-form #location').val(contact.attr('data-id'));
                    $('#contact-popup .popup-title span').text(contact.attr('data-title'));
                    $("#contact-popup").dialog("open");
                    return false;
                });
                $("#contact-popup").parent().appendTo($("form:first"));
...


Hope this will help. :)

--
Chinmaya
 
Share this answer
 
Comments
Shahnawazcode 25-Apr-13 1:44am    
Thanks Chinmaya... Thanks a lot. it works fine .
Chinmaya C 25-Apr-13 2:30am    
Most welcome dear. Happy to help. :)
Mayur V Lohite 29-Jun-13 3:31am    
hi Chinmaya_Champatiray
please can you give me your email id? or send me test mail on mayur.lohite@nullplex.com I want one help from you.
Chinmaya C 2-Jul-13 2:01am    
You can reach me at me.chinmaya@gmail.com or me.chinmaya@hotmail.com

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900