CSS compatibility with different browsers - asp.net

I have an Asp.Net create user wizard and trying to modify and arrange its labels to look same in every browser.
Now the problem is it looks fine in chrome but it looks same in IE9 and Firefox.
This is how it looks in chrome:
When I get into inspect here it shows the element .style property on the right which has two elements ie position:absolute and Z-index:2 which makes everything scrap.
Here come the problem with IE and firefox:
When it comes to firefox and IE it neglects everything:
I have give the below properties in my css file as shown below but this works only for chrome so I would like to know how would I change it for IE and as well as Firefox
.signtbl
{
z-index:2;
position:relative !important;
}
This is my entire code for my control:
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
DisableCreatedUser="True" MailDefinition-BodyFileName="~/EmailTemplates/NewAccountTemplate.htm" MailDefinition-From="noreply#imgaid.com" LoginCreatedUser="False" MailDefinition-IsBodyHtml="True" MailDefinition-Priority="High" MailDefinition-Subject="Pending Activation">
<ContinueButtonStyle BorderStyle="None" CssClass="btn big" Font-Size="12px"/>
<CreateUserButtonStyle CssClass="btn big" Height="30px"
Width="125px" BorderStyle="None" Font-Size="12px" />
<MailDefinition BodyFileName="~/EmailTemplates/NewAccountTemplate.htm"
From="noreply#xyz.com" IsBodyHtml="True" Priority="High"
Subject="Pending Activation">
</MailDefinition>
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
<ContentTemplate>
<table>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" CssClass="signtbl">User Name:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server" BorderStyle="Solid" BorderWidth="1px" BorderColor="#0099CC" BackColor="#FAFFBD" AutoCompleteType="Disabled"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="User Name is required."
ToolTip="User Name is required." ValidationGroup="CreateUserWizard1"
CssClass="signupvalidators" ForeColor="Red">*</asp:RequiredFieldValidator>
<div id="divUsernameAvailability" runat="server"></div>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password" CssClass="signtbl">Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="Password" runat="server" TextMode="Password" BorderStyle="Solid" BorderWidth="1px" BorderColor="#0099CC" BackColor="#FAFFBD"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
ControlToValidate="Password" ErrorMessage="Password is required."
ToolTip="Password is required." ValidationGroup="CreateUserWizard1"
CssClass="signupvalidators" ForeColor="Red">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="ConfirmPasswordLabel" runat="server"
AssociatedControlID="ConfirmPassword" CssClass="signtbl">Confirm Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="ConfirmPassword" runat="server" TextMode="Password" BorderStyle="Solid" BorderWidth="1px" BorderColor="#0099CC" BackColor="#FAFFBD"></asp:TextBox>
<asp:RequiredFieldValidator ID="ConfirmPasswordRequired" runat="server"
ControlToValidate="ConfirmPassword"
ErrorMessage="Confirm Password is required."
ToolTip="Confirm Password is required."
ValidationGroup="CreateUserWizard1" CssClass="signupvalidators" ForeColor="Red">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email" CssClass="signtbl">E-mail:</asp:Label>
</td>
<td>
<asp:TextBox ID="Email" runat="server" BorderStyle="Solid" BorderWidth="1px" BorderColor="#0099CC" BackColor="#FAFFBD"></asp:TextBox>
<asp:RequiredFieldValidator ID="EmailRequired" runat="server"
ControlToValidate="Email" ErrorMessage="E-mail is required."
ToolTip="E-mail is required." ValidationGroup="CreateUserWizard1"
CssClass="signupvalidators" ForeColor="Red">*</asp:RequiredFieldValidator>
<div id="divEmailAvailability" runat="server"></div>
</td>
</tr>
<%--<tr>
<td align="right">
<asp:Label ID="QuestionLabel" runat="server" AssociatedControlID="Question" CssClass="signtbl">Security Question:</asp:Label>
</td>
<td>
<asp:TextBox ID="Question" runat="server" BorderStyle="Solid" BorderWidth="1px" BorderColor="#0099CC" BackColor="#FAFFBD"></asp:TextBox>
<asp:RequiredFieldValidator ID="QuestionRequired" runat="server"
ControlToValidate="Question" ErrorMessage="Security question is required."
ToolTip="Security question is required."
ValidationGroup="CreateUserWizard1" CssClass="signupvalidators" ForeColor="Red">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="AnswerLabel" runat="server" AssociatedControlID="Answer" CssClass="signtbl">Security Answer:</asp:Label>
</td>
<td>
<asp:TextBox ID="Answer" runat="server" BorderStyle="Solid" BorderWidth="1px" BorderColor="#0099CC" BackColor="#FAFFBD"></asp:TextBox>
<asp:RequiredFieldValidator ID="AnswerRequired" runat="server"
ControlToValidate="Answer" ErrorMessage="Security answer is required."
ToolTip="Security answer is required." ValidationGroup="CreateUserWizard1"
CssClass="signupvalidators" ForeColor="Red">*</asp:RequiredFieldValidator>
</td>
</tr>--%>
<tr>
<td align="center" colspan="2">
<asp:RegularExpressionValidator ID="UsernameLength" runat="server"
ErrorMessage="Username should be minimum 5-10 characters."
ControlToValidate="UserName" Display="Dynamic" ForeColor="Red"
ValidationExpression="^[\s\S]{5,10}$" ValidationGroup="CreateUserWizard1"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:CompareValidator ID="PasswordCompare" runat="server"
ControlToCompare="Password" ControlToValidate="ConfirmPassword"
Display="Dynamic"
ErrorMessage="The Password and Confirmation Password must match."
ValidationGroup="CreateUserWizard1" ForeColor="Red"></asp:CompareValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:RegularExpressionValidator ID="PasswordLength" runat="server" Display="Dynamic"
ErrorMessage="Password length minimum: 7. Non-alphanumeric characters required: 1"
ControlToValidate="Password" ValidationExpression="(?=^.{7,51}$)([A-Za-z]{1})([A-Za-z0-9!##$%_\^\&\*\-\.\?]{5,49})$"
ForeColor="Red" ValidationGroup="CreateUserWizard1"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:RegularExpressionValidator ID="EmailValidator" runat="server" Display="Dynamic"
ControlToValidate="Email" ErrorMessage="Please enter a valid e-mail address." ValidationExpression="^[\w-]+(\.[\w-]+)*#([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$" ForeColor="Red" ValidationGroup="CreateUserWizard1"></asp:RegularExpressionValidator>
</td>
</tr>
</table>
<%-- <asp:UpdateProgress ID="UpdateProgressUserDetails" runat="server" DisplayAfter="0">
<ProgressTemplate>
<div style="position: absolute; top: 215px; left:140px;">
<img src="img/Loader.gif" alt="loading" /><br />
</div>
</ProgressTemplate>
</asp:UpdateProgress>--%>
</ContentTemplate>
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
<ContentTemplate>
<table>
<tr>
<td align="center" colspan="2">
Complete</td>
</tr>
<tr>
<td>
Your account has been successfully created.</td>
</tr>
<%--<tr>
<td align="right" colspan="2">
<asp:Button ID="ContinueButton" runat="server" BorderStyle="None"
CausesValidation="False" CommandName="Continue" CssClass="btn big"
Font-Size="12px" Text="Continue" ValidationGroup="CreateUserWizard1" />
</td>
</tr>--%>
</table>
</ContentTemplate>
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>

why dont you try using tables to align your controls in grid structure that might often help.
here's what you can do.Create a div where you want to place your controls
within the div first create a tabular structure then place control in individual
try may be this could help

Related

Second button Event is not happening in Update panel in aspx page

I have a aspx page in which i have putted two update panel with two submit buttons one in each...But on clicking second button it is not firing second button event it is taking first button validate message..
Here is my aspx page code....
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="updDate1" runat="server" UpdateMode="Conditional" style="position: absolute;
left: 0px; top: 0px; width: 339px; height: 243px;">
<ContentTemplate>
<table width="400">
<tr>
<td>
</td>
<td colspan="2">
<b>Sign Up for New User Account</b>
</td>
</tr>
<tr>
<td>
UserName:
</td>
<td>
<asp:TextBox ID="txtUserName" runat="server" />
</td>
<td>
<asp:RequiredFieldValidator ID="rqfUserName" runat="server" ControlToValidate="txtUserName"
Display="Dynamic" ErrorMessage="Required" ForeColor="Red" />
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<asp:TextBox ID="txtPwd" runat="server" TextMode="Password" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtPwd"
Display="Dynamic" ErrorMessage="Required" ForeColor="Red" />
</td>
</tr>
<tr>
<td>
Confirm Password:
</td>
<td>
<asp:TextBox ID="txtCnfPwd" runat="server" TextMode="Password" />
</td>
<td>
<asp:RequiredFieldValidator ID="PasswordConfirmRequiredValidator" runat="server"
ControlToValidate="txtCnfPwd" ForeColor="red" Display="Dynamic" ErrorMessage="Required" />
<asp:CompareValidator ID="PasswordConfirmCompareValidator" runat="server" ControlToValidate="txtCnfPwd"
ForeColor="red" Display="Dynamic" ControlToCompare="txtPwd" ErrorMessage="Confirm password must match password." />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" Text="Create User" />
</td>
<tr>
<td class="style1" colspan="3">
<asp:Label ID="lblResult" runat="server" Font-Bold="true" />
</td>
</tr>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<div>
<asp:UpdatePanel ID="updDate2" runat="server" UpdateMode="Conditional" RenderMode="Inline"
style="position: absolute; left: 628px; top: 0px; width: 339px; height: 243px;">
<ContentTemplate>
<div class="GridviewDiv">
<table>
<tr>
<td align="right">
</td>
</tr>
<tr>
<td>
<asp:GridView ID="gvRoles" runat="server" CssClass="Gridview" AutoGenerateColumns="false">
<HeaderStyle BackColor="#df5015" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkRole" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Role Name">
<ItemTemplate>
<asp:Label ID="lblRole" runat="server" Text="<%#Container.DataItem %>" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnAssign" runat="server" Text="Assign or UnAssign" OnClick="btnAssign_Click"
Style="height: 26px" />
</td>
</tr>
</table>
<div>
<asp:Label ID="lblSuccess" runat="server" Font-Bold="true" />
<br />
<asp:Label ID="lblError" runat="server" Font-Bold="true" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
Any help will be highly apprecited..
Thanks In advance..
Dear i tried your code by Making dummy project and it clearly tells me that it's a problem of CausesValidation="false",I know you tried this thing as well but even i don't know your back end coding.So same suggesstion from my side just change your btnAssign like
<asp:Button ID="btnAssign" runat="server" Text="Assign or UnAssign"
Style="height: 26px" onclick="btnAssign_Click" CausesValidation="false" />
Note :- Try to check it in different browser as well.
Also try for ValidationGroup as well.
Apply ValidationGroup property into your validation control and also assign that same property to btnSubmit.This will work.
Hope it works.
Set CausesValidation="false" in the second button
Setting CausesValidation="false" in the second button should have worked.
One another way to get this work is to assign a common ValidationGroup to your Validators as well as to your first Submit button [only of UpdatePanel updDate1 ].
For e.g. in your Validators:
<asp:RequiredFieldValidator ID="rqfUserName" runat="server"
ControlToValidate="txtUserName"Display="Dynamic"
ErrorMessage="Required" ForeColor="Red"
ValidationGroup="updDate1UserCreation" />
And your submit button with ID:btnSubmit
<asp:Button ID="btnSubmit" runat="server"
OnClick="btnSubmit_Click" Text="Create User"
ValidationGroup="updDate1UserCreation" />
Your first updatePanel will finally look like:
<asp:UpdatePanel ID="updDate1" runat="server" UpdateMode="Conditional"
style="position: absolute;
left: 0px; top: 0px; width: 339px; height: 243px;">
<ContentTemplate>
<table width="400">
<tr>
<td>
</td>
<td colspan="2">
<b>Sign Up for New User Account</b>
</td>
</tr>
<tr>
<td>
UserName:
</td>
<td>
<asp:TextBox ID="txtUserName" runat="server" />
</td>
<td>
<asp:RequiredFieldValidator ID="rqfUserName" runat="server"
ControlToValidate="txtUserName"
Display="Dynamic" ErrorMessage="Required" ForeColor="Red"
ValidationGroup="updDate1UserCreation" />
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<asp:TextBox ID="txtPwd" runat="server" TextMode="Password" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="txtPwd"
Display="Dynamic" ErrorMessage="Required" ForeColor="Red"
ValidationGroup="updDate1UserCreation" />
</td>
</tr>
<tr>
<td>
Confirm Password:
</td>
<td>
<asp:TextBox ID="txtCnfPwd" runat="server" TextMode="Password" />
</td>
<td>
<asp:RequiredFieldValidator ID="PasswordConfirmRequiredValidator"
runat="server"
ControlToValidate="txtCnfPwd" ForeColor="red"
Display="Dynamic" ErrorMessage="Required"
ValidationGroup="updDate1UserCreation" />
<asp:CompareValidator ID="PasswordConfirmCompareValidator"
runat="server" ControlToValidate="txtCnfPwd"
ForeColor="red" Display="Dynamic" ControlToCompare="txtPwd"
ErrorMessage="Confirm password must match password."
ValidationGroup="updDate1UserCreation" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnSubmit" runat="server"
OnClick="btnSubmit_Click" Text="Create User"
ValidationGroup="updDate1UserCreation" />
</td>
<tr>
<td class="style1" colspan="3">
<asp:Label ID="lblResult" runat="server" Font-Bold="true" />
</td>
</tr>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>

Get the input from a form to display in textbox in the same web page

My form collecting input.
<table>
<tr>
<td>First Name:</td>
<td><asp:TextBox ID="txtFirstName" runat="server">
</asp:TextBox>
</td>
<td class="style2"><asp:RequiredFieldValidator ID="rfvFirstName"
runat="server"
ControlToValidate="txtFirstName"
ErrorMessage="First Name can't be left blank"
SetFocusOnError="True">*
</asp:RequiredFieldValidator>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>Business</asp:ListItem>
<asp:ListItem>Other</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>Last Name:</td>
<td><asp:TextBox ID="txtLastName" runat="server">
</asp:TextBox></td>
<td class="style2"><asp:RequiredFieldValidator
ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtLastName"
ErrorMessage="Last Name can't be left blank"
SetFocusOnError="True">*
</asp:RequiredFieldValidator>
</td></tr>
<tr><td>UserName:</td>
<td><asp:TextBox ID="txtUserName" runat="server">
</asp:TextBox>
</td>
<td class="style2"><asp:RequiredFieldValidator
ID="rfvUserName"
runat="server"
ControlToValidate="txtUserName"
ErrorMessage="UserName can't be left blank"
SetFocusOnError="True">*
</asp:RequiredFieldValidator>
</td></tr>
<tr><td>Password:</td>
<td><asp:TextBox ID="txtPwd" runat="server"
TextMode="Password">
</asp:TextBox>
</td>
<td class="style2"><asp:RequiredFieldValidator ID="rfvPwd"
runat="server" ControlToValidate="txtPwd"
ErrorMessage="Password can't be left blank"
SetFocusOnError="True">*
</asp:RequiredFieldValidator>
</td></tr>
<tr><td>Confirm Password:</td>
<td><asp:TextBox ID="txtRePwd" runat="server"
TextMode="Password">
</asp:TextBox>
</td>
<td class="style2"><asp:CompareValidator ID="CompareValidator1"
runat="server"
ControlToCompare="txtRePwd"
ControlToValidate="txtPwd"
Operator="Equal"
ErrorMessage="Password and confirm password do not match"
SetFocusOnError="True">
</asp:CompareValidator>
</td></tr>
<tr><td class="style1">Gender:</td>
<td class="style1"><asp:RadioButtonList ID="rdoGender"
runat="server">
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>Female</asp:ListItem>
</asp:RadioButtonList>
</td>
<td class="style3"><asp:RequiredFieldValidator
ID="RequiredFieldValidator2"
runat="server"
ControlToValidate="rdoGender"
ErrorMessage="Gender can't be left blank"
SetFocusOnError="True">*
</asp:RequiredFieldValidator>
</td></tr>
<tr><td>Address:</td>
<td><asp:TextBox ID="txtAdress" runat="server"
TextMode="MultiLine">
</asp:TextBox>
</td>
<td class="style2"><asp:RequiredFieldValidator ID="rfvAddress"
runat="server"
ControlToValidate="txtAdress"
ErrorMessage="Address can't be left blank"
SetFocusOnError="True">*
</asp:RequiredFieldValidator>
</td></tr>
<tr><td>Email ID:</td>
<td><asp:TextBox ID="txtEmailID" runat="server">
</asp:TextBox>
</td>
<td class="style2"><asp:RequiredFieldValidator
ID="RequiredFieldValidator3"
runat="server"
ControlToValidate="txtEmailID"
ErrorMessage="Email can't be left blank"
SetFocusOnError="True">*
</asp:RequiredFieldValidator>
</td></tr>
<tr><td><asp:Label ID="lblMsg" runat="server">
</asp:Label>
</td>
<td><asp:ValidationSummary ID="ValidationSummary1"
runat="server" ShowMessageBox="True"
ShowSummary="False"/>
</td></tr>
<tr><td><asp:Button ID="btnSave" runat="server"
Text="Sign Up"
onclick="btnSave_Click"/>
</td></tr>
</table>
I know this is set up for a server which I will work on next,
right now I am just trying to get the btnsave button to display the input from the form into a plain textbox.
How is this done?
To do that on the code behind just use the Request.Form, contains all the form data in one line.
So your final code will be something like txtLiteral.Text = Request.Form.ToString()

File Uploader not working wnen used in ajax tab container with update panel

I am using ajax tab container with update panel and file uploader
fileuploaderId.HasFille always blank.
Here is my html code
<cc1:TabPanel ID="tour" runat="server">
<HeaderTemplate>
<span class="label_Tag_big">भ्रमण (Tours)</span></HeaderTemplate>
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<center class="control_bg">
<table width="75%" cellspacing="1">
<tr>
<td style="background-color: #996666">
<table width="100%" align="center" cellpadding="0" cellspacing="1">
<tr class="form_heading">
<td colspan="2">
<asp:Label ID="lbl" runat="server" Text="भ्रमण (Tours)"></asp:Label>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
विभागाध्‍यक्ष / अधिकारी का पद नाम
</td>
<td>
designation location, department
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
<asp:Label ID="lblCurrentTT" runat="server"></asp:Label>
का लक्ष्‍य
</td>
<td>
<asp:Label ID="lblTargetT" runat="server"></asp:Label>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
<asp:Label ID="lblCurrentTA" runat="server"></asp:Label>
की लक्ष्‍य प्राप्ति
</td>
<td>
<asp:Label ID="lblAchivedT" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="form_sub_heading" colspan="2" align="left">
भ्रमण का विवरण (Tours details)
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td width="45%">
दौरे का स्थान
</td>
<td width="55%">
<table width="100%" cellpadding="3" cellspacing="0">
<tr>
<td width="50%">
<asp:DropDownList ID="ddlLocLevel" runat="server" OnSelectedIndexChanged="ddlLocLevel_SelectedIndexChanged"
AutoPostBack="True" Width="200px" />
<asp:RequiredFieldValidator ID="rfqLocLevel" runat="server" InitialValue="0" ControlToValidate="ddlLocLevel"
Display="None" ErrorMessage="दौरे का स्थान चुनें " ValidationGroup="tour"></asp:RequiredFieldValidator>
</td>
<td width="50%">
<asp:DropDownList ID="ddlLocation" runat="server" OnSelectedIndexChanged="ddlLocation_SelectedIndexChanged"
AutoPostBack="True" Width="200px">
<asp:ListItem Text="-- चुनें --" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfqLocation" runat="server" InitialValue="0" ControlToValidate="ddlLocation"
Display="None" ErrorMessage="-- चुनें --" ValidationGroup="tour" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:DropDownList ID="ddlSubDistrict" runat="server" OnSelectedIndexChanged="ddlSubDistrict_SelectedIndexChanged"
AutoPostBack="True" Width="200px">
<asp:ListItem Text="-- तहसील चुनें --" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfqddlSubDistrict" runat="server" InitialValue="0"
ControlToValidate="ddlSubDistrict" Display="None" ErrorMessage="-- चुनें --"
ValidationGroup="tour" Enabled="false"></asp:RequiredFieldValidator>
</td>
<td>
<asp:DropDownList ID="ddlPoliceStation" runat="server" Width="200px">
<asp:ListItem Text="-- पुलिस थाना चुनें --" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfqddlPoliceStation" runat="server" InitialValue="0"
ControlToValidate="ddlPoliceStation" Display="None" ErrorMessage="-- पुलिस थाना चुनें --"
ValidationGroup="tour" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
<asp:Label ID="lblTourStartDate" runat="server" Text="दौरे की तिथि "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtTourStartDate" runat="server" Width="25%" CssClass="date" onkeypress="return false;"
onPaste="return false;"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtTourStartDate"
Format="dd/MM/yyyy">
</cc1:CalendarExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTourStartDate"
ErrorMessage="दौरे की आरम्भिक तिथि डाले" ValidationGroup="tour" Display="None"></asp:RequiredFieldValidator>
से
<asp:TextBox ID="txtTourEndDate" runat="server" Width="25%" onkeypress="return false;"
onPaste="return false;"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtTourEndDate"
Format="dd/MM/yyyy">
</cc1:CalendarExtender>
तक
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtTourEndDate"
ErrorMessage="दौरे की समाप्ति तिथि डाले" ValidationGroup="tour" Display="None"></asp:RequiredFieldValidator>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
दौरे के दौरान निरीक्षण किया गया ?
</td>
<td>
<asp:RadioButtonList ID="rdbtnInsp" runat="server" RepeatDirection="Horizontal" AutoPostBack="true"
OnSelectedIndexChanged="rdbtnInsp_SelectedIndexChanged">
<asp:ListItem Text="नही" Value="0"></asp:ListItem>
<asp:ListItem Text="हाँ" Value="1"></asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
निरीक्षण नही किये जाने की स्थिति मे टिप्पणी
</td>
<td>
<asp:TextBox ID="txtConIns" runat="server" TextMode="MultiLine" MaxLength="4000"
Enabled="false" Rows="3" Width="97%"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfqConIns" runat="server" ControlToValidate="txtConIns"
ValidationGroup="tour" ErrorMessage="निरीक्षण नही किये जाने की स्थिति मे टिप्पणी डाले "
Enabled="false" Display="None">
</asp:RequiredFieldValidator>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
दौरे के दौरान रात्री विश्राम किया गया ?
</td>
<td>
<asp:RadioButtonList ID="rdbtnNHault" runat="server" RepeatDirection="Horizontal"
AutoPostBack="true" OnSelectedIndexChanged="rdbtnNHault_SelectedIndexChanged">
<asp:ListItem Text="नही" Value="0"></asp:ListItem>
<asp:ListItem Text="हाँ" Value="1"></asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
रात्री विश्राम नही किये जाने की स्थिति मे टिप्पणी
</td>
<td>
<asp:TextBox ID="txtConNHault" runat="server" TextMode="MultiLine" MaxLength="4000"
Enabled="false" Rows="3" Width="97%"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfqConNHault" runat="server" ControlToValidate="txtConNHault"
Display="None" ValidationGroup="tour" ErrorMessage="रात्री विश्राम नही किये जाने की स्थिति मे टिप्पणी डाले "
Enabled="false">
</asp:RequiredFieldValidator>
<asp:ValidationSummary ID="vsTour" runat="server" ShowSummary="False" ShowMessageBox="true"
ValidationGroup="tour" />
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
<asp:Label ID="Label8" runat="server" Text="संलग्न निरीक्षण रिपोर्ट "></asp:Label>
</td>
<td>
<asp:FileUpload ID="fuTourReport" runat="server" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="Only pdf file is allowed!"
ValidationExpression="^.+(.pdf|.PDF)$" ControlToValidate="fuTourReport" Display="None"
ValidationGroup="nhalt"> </asp:RegularExpressionValidator>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td colspan="2" align="center">
<asp:Button ID="btnSaveTour" runat="server" Text="Submit" ValidationGroup="tour"
OnClick="btnSaveTour_Click" CssClass="savetour" />
<asp:Button ID="btnCancelTour" runat="server" Text="Cancel" CausesValidation="False" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<center style="padding-top: 5px">
<asp:GridView ID="grdTours" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataKeyNames="tourId" Width="100%" OnPageIndexChanging="grdTours_PageIndexChanging"
OnRowCommand="grdTours_RowCommand">
<Columns>
<asp:BoundField DataField="Location_NameH" HeaderText="दौरे का स्थान " />
<asp:BoundField DataField="tourStartDate" HeaderText="आरम्‍भिक तिथि" DataFormatString="{0:dd/MM/yyyy}" />
<asp:BoundField DataField="tourEndDate" HeaderText="समाप्‍ति की तिथि" DataFormatString="{0:dd/MM/yyyy}" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkinsdetail" runat="server" Text="Detail" CommandName="insdetail"
CommandArgument='<%#Eval("tourId")%>'></asp:LinkButton></ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</center>
</center>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
I have already tried this
<Triggers>
<asp:PostBackTrigger ControlID="clickButton" />
</Triggers>
and
protected void Page_Init(object sender, EventArgs e)
{
PostBackTrigger trig = new PostBackTrigger();
trig.ControlID = btnSaveTour.UniqueID;
UpdatePanel1.Triggers.Add(trig);
}
but no luck ....
Unfortunately, the FileUpload control doesn't work inside an UpdatePanel
You don't have many options really other than removing the UpdatePanel or looking at working around it by using something like the AsyncFileUpload control
See this answer for some more detail
Dave

asp.net (Visual Studio 2010) form validation controls

Afternoon All,
I have a web form that i wish my user to fill out. On the form i have three fields that i wish to set validation on. One of these is a normal textbox, the other a textbox associated with a calendar icon and my last field is a drop down list that has data held in it populated from an Enum list.
Im not too worried about my dropdown list yet, but i am getting slightly frustrated with my other two textboxes. I have used a 'Required Filed Validator' on both of these and only want the validation to kick in when the users clicks the submit button. At the moment if you tab or click between these two fields the validation kicks in.
Here is my web form....
<table id="table-3">
<tr>
<td style="width: 385px">
<asp:Label ID="lblOrganiser" runat="server" Text="Meeting Organiser:">
</asp:Label></td>
<td class="style4" style="width: 23px">
<asp:TextBox ID="txtOrganiser" runat="server" >
</asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldVal0"
ControlToValidate="txtOrganiser"
ErrorMessage="Meeting Organiser"
Text="*"
runat="server"/>
</td>
<td>
<asp:Label ID="lblDate" runat="server" Width="40px" Text="Date:">
</asp:Label>
</td>
<td class="style5">
<asp:TextBox ID="txtAgendaDate" runat="server" ForeColor="Black" >
</asp:TextBox>
<asp:ImageButton runat="Server" ID="ImageButton1" ImageUrl="~/images/contact_date_SM3.png"
AlternateText="Click here to display calendar" ImageAlign="AbsMiddle" />
<asp:calendarextender ID="CalendarExtender3" runat="server"
TargetControlID="txtAgendaDate" PopupButtonID="ImageButton1" Format="dd/MM/yyyy"></asp:calendarextender>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldVal1"
ControlToValidate="txtAgendaDate"
ErrorMessage="Date"
Text="*"
runat="server"/>
</td>
</tr>
<tr>
<td style="width: 385px"><asp:Label ID="lblAgendaTypeDescription" runat="server" Text="Type Of Meeting:"></asp:Label></td>
<td class="style4" style="width: 23px">
<asp:TextBox ID="txtAgendaTypeDescription" runat="server" Text="Monthly" BackColor="#F4F4F4" ReadOnly="True"></asp:TextBox>
</td>
<td></td>
<td class="style7" style="width: 24px"><asp:Label ID="lblTime" runat="server" Text="Time"></asp:Label></td>
<td><asp:TextBox ID="txtTime" runat="server"
Text="4pm" style="margin-top: 2px"></asp:TextBox></td>
<td></td>
</tr>
<tr>
<td style="width: 385px">
<asp:Label ID="lblVenue" runat="server" Text="Venue"></asp:Label>
</td>
<td class="style4" colspan="6"><asp:TextBox ID="txtVenue" runat="server"
Text="Room 1" Width="550px" TextMode="SingleLine" ></asp:TextBox></td>
</tr>
<tr>
<td style="width: 385px"><asp:Label ID="lblRead" runat="server" Text="Please Read:"></asp:Label></td>
<td class="style4" colspan="6">
<asp:TextBox ID="txtRead" runat="server"
Width="550px" TextMode="SingleLine" Font-Names="Verdana" ></asp:TextBox></td>
</tr>
<tr>
<td style="width: 385px"><asp:Label ID="lblBring" runat="server" Text="Please Bring:"></asp:Label></td>
<td class="style4" colspan="6">
<asp:TextBox ID="txtBring" runat="server"
Width="550px" TextMode="SingleLine" Font-Names="Verdana" ></asp:TextBox></td>
</tr>
<tr>
<td style="width: 385px"><asp:Label ID="lblAgendaStatus" runat="server" Text = "Agenda Status" ></asp:Label></td>
<td class="style4" style="width: 23px">
<asp:DropDownList ID="AgendaStatus"
runat="server" Height="24px" Width="125px"> </asp:DropDownList>
</td>
<td> <asp:RequiredFieldValidator ID="RequiredFieldVal2"
ControlToValidate="AgendaStatus"
ErrorMessage="Agenda Status"
Text="*"
runat="server"/>
</td>
</tr>
</table>
<br />
<asp:ValidationSummary ID="ValidationSummary2"
HeaderText="You must enter a value in the following fields:"
DisplayMode="BulletList"
EnableClientScript="true"
runat="server"/>
<br />
<div style="text-align: right;">
<asp:ImageButton runat="Server" ID="btnAddMonthlyTemplate" ImageUrl="~/images/Addbutton.png"
AlternateText="Add Weekly Template" />
</div>
If anyone cant point me in the right direction that would be great. Many thanks in advance.
Betty
You can set the EnableClientScript property of the RequiredFieldValidator to false:
<asp:RequiredFieldValidator ID="RequiredFieldVal1"
ControlToValidate="txtAgendaDate"
ErrorMessage="Date"
Text="*"
EnableClientScript="false"
runat="server"/>
that way the validation will accur only after the user posts the form.
Hope this helps,
Shai.

Why does nothing happen when I press submit on my ASP.NET registration form?

I have a registration form that is connected to a database table that uses RequiredFieldValidators, RegularExpressionValidators, and PasswordStrength. When I press submit, nothing happens. Any clue why this is happening? Please can you help. Thank you.
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
<div style="margin-left:30%;margin-top:40px;">
<asp:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" TargetControlID="MainPanel" BorderColor="blue" Radius="6" Corners="All"></asp:RoundedCornersExtender>
<asp:Panel ID="MainPanel" BackColor="Transparent" runat="server" BorderWidth="5" BorderStyle="Solid" BorderColor="blue" Width="525" Height="475">
<div style="margin-left:10px;margin-top:10px">
<h2 style="color:Blue;text-align:center">Registration</h2>
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="150"><asp:Label ID="lblFirstname" runat="server" Font-Names="Tahoma" Text="First name:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtFirstname" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvFirstname" runat="server" ControlToValidate="txtFirstname" ErrorMessage="First name is required." ToolTip="First name is required."></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150"><asp:Label ID="lblMiddlename" runat="server" Font-Names="Tahoma" Text="Middle name:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtMiddlename" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvMiddlename" runat="server" ControlToValidate="txtMiddlename" ErrorMessage="Middle name is required." ToolTip="Middle name is required."></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150"><asp:Label ID="lblLastname" runat="server" Font-Names="Tahoma" Text="Last name:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtLastname" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvLastname" runat="server" ControlToValidate="txtLastname" ErrorMessage="Last name is required." ToolTip="Last name is required."></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150"></td>
<td width="350" class="smtxt">Tip: Make sure the names match the traveler's passport or driver's license to avoid travel delays.</td></tr>
</table>
<hr align="left" width="500" />
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="150"><asp:Label ID="lblUsername" runat="server" Font-Names="Tahoma" Text="Username:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtUsername" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvUsername" runat="server" ControlToValidate="txtUsername" ErrorMessage="Username is required."></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150"><asp:Label ID="lblEmailAddress" runat="server" Font-Names="Tahoma" Text="Email address:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtEmailAddr" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Text="You must enter an email address" ErrorMessage="You must enter an email address" Display="None" ControlToValidate="txtEmailAddr" ValidationExpression="\w+([-+.']\w+)*#\w+([-.]\w+)*\.w+([-.]\w+)*"></asp:RegularExpressionValidator>
</td>
</tr>
...
You are probably failing one of the validators requirements and just not displaying the error message. I would look at your validators and make sure that they are not suppressing error messages or you're passing those messages to a summary control

Resources