Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sherry Ann Hernandez 320 posts 344 karma points
    Dec 21, 2010 @ 08:51
    Sherry Ann Hernandez
    0

    Adding a new usercontrol prevents postback of my submit button

    Hello Guys,

    I have a problem with my two usercontrol.

    At first my first form is working correctly. Clicking the submit button will redirect to the right page. The problem occurs when I add a new user control. The submit button is not firing any event.

     

  • Thomas Stock 40 posts 70 karma points
    Dec 21, 2010 @ 10:02
    Thomas Stock
    0

    Hello.

    How can we help you solving this without any additional information?

    Could you post some code and extra details about the difference between the two controls?

    Did you update the DLL next to copying the .ascx?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 21, 2010 @ 10:05
    Jan Skovgaard
    0

    Hi Sherry

    Are you sure not one of them is firing? In ASP.NET it can be such a pain to work with forms if you have more than one. For the bright .NET guys in here it's probably pretty easy to resolve this.

    But if you have a <form runat="server"></form> sorrounding your content you can't use other forms inside it. Then you need to make some grouping in your user control so the right form is fired on the click event.

    Anyhow this could also be because of some interferring code so as Thomas is saying please provide us with some more information. Perhaps some code snippets etc.

    /Jan

  • Sherry Ann Hernandez 320 posts 344 karma points
    Dec 21, 2010 @ 10:19
    Sherry Ann Hernandez
    0

     This is my code behind for my submit button

     

     

     

    protected void submitInquiry_Click(object sender, EventArgs e)

    {

     

     

    string checkIn = txtCheckin.Value;

     

     

    string checkOut = txtCheckout.Value;

     

     

    string adultCount = txtAdult.Value;

     

     

    string childrenCount = txtChildren.Value;

     

     

    string roomCount = txtRoom.Value;

     

     

    string promoCode = txtPromoCode.Value;

     

     

    string groupCode = txtGroupCode.Value;

     

     

    if (txtHotelValue.Value == "1")

    {

    Response.Redirect(

     

    "https://gc.synxis.com/?Hotel=15159&Chain=5375&locale=en&arrive=" + checkIn + "&depart=" + checkOut + "&adult=" + adultCount + "&child=" + childrenCount + "&rooms=" + roomCount + "&start=1&iata=&promo=" + promoCode + "&group=" + groupCode);

    }

     

     

    else if (txtHotelValue.Value == "2")

    {

    Response.Redirect(

     

    "https://gc.synxis.com/?Hotel=24311&Chain=5375&locale=en&arrive=" + checkIn + "&depart=" + checkOut + "&adult=" + adultCount + "&child=" + childrenCount + "&rooms=" + roomCount + "&start=1&iata=&promo=" + promoCode + "&group=" + groupCode);

    }

     

     

    else if (txtHotelValue.Value == "3")

    {

    Response.Redirect(

     

    "https://gc.synxis.com/?Hotel=24309&Chain=5375&locale=en&arrive=" + checkIn + "&depart=" + checkOut + "&adult=" + adultCount + "&child=" + childrenCount + "&rooms=" + roomCount + "&start=1&iata=&promo=" + promoCode + "&group=" + groupCode);

    }

     

     

    else if (txtHotelValue.Value == "4")

    {

    Response.Redirect(

     

    "https://booking.ihotelier.com/istay/istay.jsp?HotelID=17181&languageid=1&DateIn=" + checkIn + "&DateOut=" + checkOut + "&adults=" + adultCount + "&rooms=" + roomCount + "&children=" + childrenCount);

    }

     

     

    else if (txtHotelValue.Value == "5")

    {

    Response.Redirect(

     

    "https://booking.ihotelier.com/istay/istay.jsp?HotelID=17180&languageid=1&DateIn=" + checkIn + "&DateOut=" + checkOut + "&adults=" + adultCount + "&rooms=" + roomCount + "&children=" + childrenCount);

    }

     

     

    else if (txtHotelValue.Value == "6")

    {

    Response.Redirect(

     

    "https://gc.synxis.com/?Hotel=24310&Chain=5375&locale=en&arrive=" + checkIn + "&depart=" + checkOut + "&adult=" + adultCount + "&child=" + childrenCount + "&rooms=" + roomCount + "&start=1&iata=&promo=" + promoCode + "&group=" + groupCode);

    }

    }

     

    This is working fine until I added a new usercontrol on my masterpage. If I try this new user control the submit button will work. The code for the new usercontrol is this.

    <%

     

    @ Control Language="C#" AutoEventWireup="true" CodeBehind="HotelListing.ascx.cs" Inherits="HotelListing.HotelListing" %>

     

     

    <asp:ListView ID="lvHotelList" runat="server">

     

     

    <LayoutTemplate>

     

     

    <table border="0" cellpadding="0" cellspacing="0">

     

     

    <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>

     

     

    </table>

     

     

    </LayoutTemplate>

     

     

    <ItemTemplate>

     

     

    <tr onclick="goToHotel('<%# Eval("HotelURL") %>?hotelID=<%#Convert.ToInt32(Eval("HotelSortOrder")) %>',<%#Convert.ToInt32(Eval("HotelSortOrder")) %>);" class="hotelRow2" id='p<%#Convert.ToInt32(Eval("HotelSortOrder")) %>' char='<%#Convert.ToInt32(Eval("HotelSortOrder")) %>'>

     

     

    <td style="width:5px;"></td>

     

     

    <td style="width:60px;padding-right:3px;border-bottom:1px solid #fff;">

     

     

    <asp:Image ID="Image12" runat="server" ImageUrl='<%# Eval("mapThumbnail") %>' />

     

     

    </td>

     

     

    <td style="width:430px;border-bottom:1px solid #fff;padding-right:2px;">

     

     

    <div class="hotelName2" id='hotelName2<%#Convert.ToInt32(Eval("HotelSortOrder")) %>'><%# Eval("HotelName") %></div>

     

     

    <div class="starRating2" id='starRating2<%#Convert.ToInt32(Eval("HotelSortOrder")) %>'>

     

     

    <asp:Image ID="Image22" runat="server" ImageUrl='<%# Eval("HotelRating") %>' Width="80" Height="21" Visible='<%# Convert.ToBoolean(Eval("Visibility")) %>'/>

     

     

    <asp:Label ID="lblRating2" runat="server" Visible='<%# !Convert.ToBoolean(Eval("Visibility")) %>'><%# Eval("HotelRating") %></asp:Label>

     

     

    </div>

     

     

    <div class="thumbsUp2" id='thumbsUp2<%#Convert.ToInt32(Eval("HotelSortOrder")) %>'>

     

     

    <a rel='<%# Eval("RatingURL") %>'><asp:Image ID="Image3" runat="server" ImageUrl='../media/images/white_thumbs_up.png' Width="23" Height="21" /></a>

     

     

    </div>

     

     

    <div class="reviewRating2" id='rating2<%#Convert.ToInt32(Eval("HotelSortOrder")) %>' style="display:none;">

     

     

     

    </div>

     

     

    <div class="infoRow22">

     

     

    <div class="location2" id='location2<%#Convert.ToInt32(Eval("HotelSortOrder")) %>'><%# Eval("HotelLocation") %>&nbsp;

     

     

    <a id='viewMap2<%#Convert.ToInt32(Eval("HotelSortOrder")) %>' onclick="showMap(this,'<%#Eval("GoogleMap") %>')">(Show Map)</a></div>

     

     

    </div>

     

     

    <div class="infoRow32" id='infoRow32<%#Convert.ToInt32(Eval("HotelSortOrder")) %>'>

    <%

     

    # Eval("BodyLeftContent")%>&nbsp;<a href='<%# Eval("HotelURL") %>?hotelID=<%#Convert.ToInt32(Eval("HotelSortOrder")) %>' id='hotelURL2<%#Convert.ToInt32(Eval("HotelSortOrder")) %>'>More</a>

     

     

    </div>

     

     

    </td>

     

     

    <td style="width:5px;"></td>

     

     

    </tr>

     

     

    </ItemTemplate>

     

     

    </asp:ListView>

     

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft