Ajax Tab container in asp.net - asp.net

I use two user controls in a tab container.user controls inside each tab panel.
I have registration forms in each user control.if i enter save button of one user control in a tab ,required field validator error coming in second tab panel registration form..how to solve it.
pls help

Add Validation Group property in each control. Then add validation group property in appropriate button.
So when u click on button only than button validation group controls get validated. e.g
<table width="400px">
<tr>
<td style="width: 80px;">
Name :
</td>
<td>
<asp:TextBox ID="txtName" ValidationGroup="tab1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ValidationGroup="tab1" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 80px;">
Father Name
</td>
<td>
<asp:TextBox ID="txtFatherName" ValidationGroup="tab1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="tab1" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 80px;">
</td>
<td>
<asp:Button ID="btnValidate" runat="server" Text="Validate" ValidationGroup="tab1"
Width="80px" OnClick="btnValidate_Click" />
</td>
</tr>
</table>

Related

Conflict on submit button when Hit login submit button

I have two submit button in various two purpose. When i hit enter button,but Top submit button only working. how can i rectify this problem. Please guide me. I hope you get my point.
My form is below this Url
http://i.stack.imgur.com/zLnxi.jpg
Try to use asp Panel control to group your login controls and SignUp controls. And set the DefaultButton property to your desired button. Here is sample code, how to use Panel
<asp:Panel ID="Panel1" runat="server" DefaultButton="ButtonOk">
<table >
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="ButtonOk" runat="server" Text="OK" />
</td>
<td>
<asp:Button ID="ButtonCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
I hope it will helps.

How can I make the ASP.Net Login control render correctly in Internet Explorer 7?

I'm using an ASP.Net Login control in my application. In Chrome, Firefox, and IE 9, everything works ok. But we still have users on IE 7, and everything is NOT OK for them; the Login control's "UserName" box doesn't display, so they just have to guess at where to start typing in their username (see screen cap).
I've already tried converting the control to a Template and playing with the padding, etc. The control renders as a nested table, like so:
<asp:Login ID="UserLogin" runat="server" OnLoggedIn="UserLogin_LoggedIn"
DisplayRememberMe="false" UserNameLabelText="Username">
<TextBoxStyle CssClass="round" />
<TitleTextStyle Font-Bold="True" Font-Size="Large" />
<LabelStyle Font-Bold="True" />
<LayoutTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td>
<table cellpadding="5">
<tr>
<td align="center" colspan="2" style="font-size:Large;font-
weight:bold;">Log In</td>
</tr>
<tr>
<td align="right" style="font-weight:bold;">
<asp:Label ID="UserNameLabel" runat="server"
AssociatedControlID="UserName">Username:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server" CssClass="round" Width="100">
</asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="User Name is required."
ToolTip="User Name is required." ValidationGroup="UserLogin">*
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right" style="font-weight:bold;">
<asp:Label ID="PasswordLabel" runat="server"
AssociatedControlID="Password">Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="Password" runat="server" CssClass="round"
TextMode="Password" Width="100"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
ControlToValidate="Password" ErrorMessage="Password is required."
ToolTip="Password is required." ValidationGroup="UserLogin">*
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;font-weight:bold;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False">
</asp:Literal>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="LoginButton" runat="server" CommandName="Login"
Text="Log In" ValidationGroup="UserLogin" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
<FailureTextStyle Font-Bold="True" />
</asp:Login>
Does anyone have any ideas?
UPDATE: Adding ie7-js to the mix made no difference at all. So I removed it and then tried removing the CssClass="round" from the Username and Password text boxes; that was the culprit. I don't know what in jquery.corner is causing the problem, but all it means is my login page will have square corners and the rest of the application will have rounded corners - I can live with that.
I'm going out on a limb here and saying that this is a CSS issue.
You're referencing a CssClass called round - Ideally we would need to see that first.
Though I am going to guess you have a .round:focus {} too? to style the currently focused textbox. If so, this isn't supported in less than I.E 8 and will likely have some funky behaviour...
If this is the case, then check out ie7-js to help you gain missing support.

remove remember me check box from asp:login control

I want to create a login with ASP.NET 4 but without rememberMe check box. Is any way to do this?
Take a look at this
If you are using that control, you just need to put something like below in your aspx file:
<asp:Login DisplayRememberMe="False" />
Press the drop down menu and press Convert To Template. And then just delete it.
In addition, there is a property which is DisplayRememberMe you can just put it false.
You can do this just by using property of login control to control the display of RememberMe
for that you have to set that property equals to false
<asp:Login ID="Login1" runat="server" DisplayRememberMe="false">
</asp:Login>
or you can also convert this into template and can remove whatever items you don't want to use. by default template control look like this . you can remove remember me from this HTML .
<asp:Login ID="Login1" runat="server" DisplayRememberMe="false">
<LayoutTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td>
<table cellpadding="0">
<tr>
<td align="center" colspan="2">
Log In</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="User Name is required."
ToolTip="User Name is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
ControlToValidate="Password" ErrorMessage="Password is required."
ToolTip="Password is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In"
ValidationGroup="Login1" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>

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.

Open single pop up from two different buttons

I have two different buttons viz save and update. I want to open single pop-up window for both buttons, then how can I do so.? More over if pop-up is open on save buttons click then when ever it is closed, it should directed to OnClick_save() button event and if it is open from update buttons, on pop-up colse, it should directed to OnClick_Update() buttons click event.
How can I do so??
This is my code
<tr>
<td>
<table id="tblButton" runat="server">
<tr>
<td>
<asp:Button ID="btnAdd" runat="server" Text="Add" Visible="false" />
<asp:Button ID="btnUpdate" runat="server" Text="Update" Visible="false" /> <asp:Button ID="btnDelete" runat="server" Text="Delete" Visible="false" />
<asp:Button ID="btnTargetButton" runat="server" Text="PopUpTarget" Visible="false" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<cc1:ModalPopupExtender ID="ModalPopupExtenderSave" runat="server" TargetControlID="btnTargetButton" PopupControlID="passwordPopUp" DropShadow="true" PopupDragHandleControlID="header" BackgroundCssClass="modalBackground" BehaviorID="ModalPopupExtenderSave" />
</table>
<asp:Panel ID="passwordPopUp" runat="server" Style="display: none; padding: 10px;
border: 1px; border-style: solid;" BackColor="#91C83B" Width="300px" HorizontalAlign="Center"
BorderStyle="Solid" BorderWidth="5px">
<table class="TABLE100">
<tr>
<td colspan="3">
<h3 style="text-align: center;" id="header">
Confirm Password</h3>
</td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
<tr>
<td>
</td>
<td width="50px">
<asp:Label ID="lblPasswrd" runat="server" Text="Password" Font-Bold="True" Font-Size="Larger"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtPassword" runat="server" SkinID="TextBoxLong"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
<asp:Button ID="btnSubmit" runat="server" Text="SUBMIT" Width="70px" OnClick="btnSubmit_Click"/>
</td>
</tr>
</table>
</asp:Panel>
Some how I have solved the problem up to certain extent.
Now the problem is three different buttons viz. Insert, Update and delete buttons are responsible for opening pop-up window which in turn opens an ASP:panel the panel contains submit button. So on submit button, can I know which button was responsible for opening a panel.???
You can use a hidden button as modal popup's Okbutton and call then button OnClick from code. from both Save and Updated buttons.
add server side event handlers for each button click. use jquery to show popup for each button, that would be $('#button1').click and $('#button2').click from jquery.

Resources