I have a user control with three Views inside MultiView, first two views contains different controls and each have a button to submit the form, both are working as expected. Third one has two asp image button both are not attached with any validation group, causes validation is also false but post back is not happening on clicking the button, there is no javascript error i already checked that, any help is appreciated. Following is markup.
<asp:View runat="server" ID="vwPayAsGuest">
<asp:Panel ID="divButtons" runat="server" CssClass="creditcardbuttons-container">
<div class="creditcardbuttons-container-left">
</div>
<div id="divRegularPayment" class="f-left">
<asp:ImageButton runat="server" ID="lbtnRegularCheckout" ToolTip="Pay with credit card"
AlternateText="Pay with credit card" OnClick="lbtnRegularCheckout_OnClick" CausesValidation="false"/>
</div>
<div id="divPayByPayPal" class="f-left padding-left15">
<asp:ImageButton runat="server" ID="submit" CausesValidation="false"
ImageUrl="https://fpdbs.paypal.com/dynamicimageweb?cmd=_dynamic-image&buttontype=ec-mark"
AlternateText="Pay via PayPal" ToolTip="Pay via PayPal (Express Checkout)" OnClick="lnkButPayPal_Click" />
</div>
</asp:Panel>
</asp:View>
Related
I have the markup below, there is no triggers section and no setting of the triggers in the code behind. When I click on the checkbox, the page does update and show the hidden div (server side code sets visible), but page loading spinner in the page tab doesn't spin in chrome. If I remove the update and template tags, the page seems to act the same except that the page loading spinner spins.
What is actually happening? Is the page being reloaded or not? If the update panel is loading the page, why is it doing so without a defined AsyncPostBackTrigger?
<asp:UpdatePanel runat="server" ID="pnlMain">
<ContentTemplate>
<div class="control-group">
Hide Div
<div class="controls">
<asp:CheckBox ID="chkbx" CssClass="Input" runat="server" AutoPostBack="true" />
</div>
</div>
<div id="divToHide" runat="server">
stuff to hide when div is clicked
</div>
<div class="form-actions">
<asp:LinkButton ID="btnSubmit" runat="server" Text="Submit" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
Page is loaded in both cases. With Update Panel only Partial Page(Content inside the Content Template is updated) whereas in normal case entire page is re-rendered.
I am opening dialog using Jquery Mobile. Problem is that btnSend_Click event is not firing. What I am trying to do that keeping button and textbox in update panel and do post back and close dialog after ruining on code on serverside.
Sample here
Parent Page Button HTML
<a href="/Kiosk/RetrieveTickets/RetrieveTicketsBySms.aspx" data-role="button" data-inline="true" data-theme="c" class="MyBigButton"
data-inline="true" data-rel="dialog" data-transition="pop">Via SMS
<br />
<br />
<img src="/Kiosk/images/mobile.png" />
</a>
Dialog Page HTML
<div id="dlgSms" data-role="dialog" data-theme="b">
<div data-role="header" data-theme="d">
<h1>
Retrieve Tickets By SMS</h1>
</div>
<div data-role="content" data-theme="c">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<p>
Please type here your mobile number. You will get your ticket on your mobile via
SMS.</p>
<asp:TextBox runat="server" ID="txtMobileNumber" placeholder="Enter Mobile Number" />
<asp:Button ID="btnSend" Text="Send SMS Now" runat="server" data-theme="b" OnClick="btnSend_Click" />
</ContentTemplate>
</asp:UpdatePanel>
Cancel
</div>
</div>
I will describe you the main issue here.
When you click on the "Via SMS" button you open a dialog, and the script is load one diferent aspx page, the RetrieveTicketsBySms.aspx and renders it in the DOM of the previous. So the button and the update panel and the script of the RetrieveTicketsBySms.aspx is now history.
So the button its fire, but is call the RetrieveTicketsOptions.aspx page, that is not even have it, but also the hash validation is also fails, so its not fired. You also have it inside the update panel, so from what I see is not even make any post back.
The possible solution here is to place the content of the dialog, that loads the RetrieveTicketsBySms.aspx inside an iframe -if this is possible. and remove the UpdatePanel.
Why does the GridView's Command Buttons not fire properly when there are validation controls embedded in the ItemTemplate?
What is the point in allowing an EditItemTemplate if you can't even validate the user's input on the client side?!!!
The headache is not hard to reproduce, just create a simple GridView with at least one column that is an TemplateField. Place a text box and a RequiredFieldValidator on the EditItemTemplate.
Does anyone have a workaround for this issue/problem/headache?
I guess you don't have ValidationGroup for the Buttons. please try something like this:
<asp:Button ID="Button1" runat="server" ValidationGroup='GridView1' CausesValidation='true' Text="Button" />
You need to set ASPxTextBox ValidationGroup like this:
<EditItemTemplate>
<dx:ASPxTextBox ValidationSettings-ValidationGroup='<%# Container.ValidationGroup %>' ../>
</EditItemTemplate>
Look here for detailed explanation.
I just solved this problem.
when you want to put validation in certain column in gridview, you change that column to template. add your validator as usual, give it validationgroup name (as usual). then at the commandfield edit update column, convert that column also to template field, then set validationgroup name for "update" textlink.
hope that helps.
I ran into a similar problem. QA reported the update command was not firing on a DatGrid we had set up for user settings. Outside of the DataGrid, we happened to have two hidden input fields that were only visible when certain settings were in place. However, I noticed in my testing that clicking update increased the overall height of the divs these fields were in; i.e. the validation controls for those fields were firing.
The issue definitely seems to be related to the ValidationGroup setting for the validation controls.
Wan's answer was somewhat helpful, however I did not have to convert the EditCommandColumn to a template field, and merely had to add the ValidationGroup attribute to it along with the Validation control in the EditItemTemplate. The sample below is based on the implementation that worked for me:
<div class="row">
<div runat="server" id="divConfirm">
<div class="formfields float-off form-group">
<div class="col-xs-4 text-right">
<p class="align-middle">Field 1</p>
</div>
</div>
<div class="formfields float-off form-group">
<div class="col-xs-4">
<input runat="server" id="confirm1" name="confirm1" />
<!-- this control was firing prior to adding the validation group -->
<asp:RequiredFieldValidator runat="server" ID="valConfirmReq"
Display="Dynamic" ControlToValidate="confirm1"
ErrorMessage="*You must confirm etc. message">
</asp:RequiredFieldValidator>
</div>
</div>
</div>
</div>
<asp:DataGrid ID="DataGrid1" runat="server" OnEditCommand="DataGrid_EditCommand"
OnCancelCommand="DataGrid1_CancelCommand"
OnUpdateCommand="DataGrid1_UpdateCommand">
<Columns>
<asp:EditCommandColumn EditText="Edit" HeaderText="Edit"
UpdateText="Update" CancelText="Cancel" ValidationGroup="DataGrid1">
<%-- DataGrid code --%>
<asp:TemplateColumn>
<EditItemTemplate>
<asp:DropDownList ID="ddl1" runat="server"></asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvDDL" runat="server"
ErrorMessage="*Please Select"
ValidationGroup="DataGrid1"
Display="Dynamic"
ControlToValidate="ddl1"
InitialValue="Select">
</asp:RequiredFieldValidator>
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
Our problem/question revolves around an upload control that loses the selected file (goes blank) when a postback control is used (in this case, the dropdown list posts). Any insight into what we are doing wrong or how we can fix this? Below is our code and a summary of the problem.
Any help would be greatly appreciated.
Thank you!
<asp:updatepanel id="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="row">
<asp:DropDownList runat="server" AutoPostBack="true" ID="CategorySelection" OnSelectedIndexChanged="CategorySelection_IndexChanged" CssClass="drop-down-list" />
</div>
<div id="SubCategory" class="row" runat="server" visible="false">
<asp:DropDownList runat="server" ID="SubCategorySelection" CssClass="drop-down-list" />
</div>
<div class="row">
<asp:FileUpload runat="server" ID="FileUpload" CssClass="file-upload" />
</div>
<div class="row">
<asp:Button ID="submit" runat="server" Text="Submit" CssClass="button" OnClick="submit_ButtonClick" />
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="submit" />
</Triggers>
</asp:updatepanel>
In this form we have 2 DropDownList, 1 FileUpload and 1 submit button. Every time that the user selects one category, the subcategories are loaded (AutoPostBack=”true”).
The primary user flow works fine: User selects one category, subcategory and selects a file to be uploaded (submitted). HOWEVER, if the user selects a file first, and then selects a category, the screen will do a partial refresh and the selected file will disappear (field goes blank). As a result, the user needs to select the file again. This causes an issue because the fact that the file is no longer selected can easily be overlooked.
Seems straighforward --- but causing us a lot of grief. Any experts out there that can help?
BIG thanks!
That is the behavior of the input type=file i.e. it can't be pre-populated. Move the FileUpload outside of the UpdatePanel. In your markup, you could move both FileUpload and the submit Button outside of the UpdatePanel.
I have a simple form written in asp.net/C# and when trying to hit enter while in the form's input box doesn't submit the form for some reason. I had implemented a fix for a previous bug where pressing enter would merely refresh the page without submitting the form data but now pressing enter just does nothing, the fix is below:
<div style="display: none">
<input type="text" name="hiddenText" />
</div>
anybody know about a fix for this or a workaround?
I'm assuming you have a button somewhere on your page, as well as an event handler for it.
Have you tried wrapping your form (with the button) inside a Panel control and setting the default button attribute?
i.e.
<asp:Panel id="pnlMyForm" runat="server" DefaultButton="btnMyButton">
<asp:textbox id="txtInput" runat="server" />
<asp:Button id="btnMyButton" text="Submit" runat="server" />
</asp:Panel>
You can specify a default button for a form, which means hitting enter on any input control will fire that button (i.e. target the submit button). I haven't heard of this not working in any specific browser. This should eliminate your need for a workaround/hack.
<form id="form1" runat="server">
<asp:Panel ID="pnlFormContents" runat="server" DefaultButton="btnSubmit">
<!-- add some input controls as needed -->
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click"/>
</asp:Panel>
</form>
Hope this helps...
I don't remember the specifics of the rules, but most browsers have the capability of submitting forms when ENTER is pressed if conditions are met. I think it had to do with whether you had 1 or more-than-one field, or whether or not there was at least one submit button (even if you hide it). I've done it in a site I recently did, but I don't have the code handy, but I can tell you it works without any special scripting. Check this posting for more details:
http://manfred.dschini.org/2007/09/20/submit-form-on-enter-key/