I am using <ajax:TabContainer> & <ajax:TabPanel> but some how I cannot see tabs clearly. It just half of the tab.
Here is my code :
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<ajax:ToolkitScriptManager ID="ScriptManager1" runat="server"/>
<ajax:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1">
<ajax:TabPanel runat="server" ID="tbpnluser">
<HeaderTemplate>
Home
</HeaderTemplate>
<ContentTemplate>
<table>
<tr>
<b>Registration Form</b>
</tr>
<tr>
<td>
UserName:
</td>
<td>
<asp:TextBox ID="txtuser" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<asp:TextBox ID="txtpwd" runat="server" TextMode="Password"> </asp:TextBox>
</td>
</tr>
</table>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
Output:
http://imgur.com/171LwlE
I have changed AJAX dlls all that but not getting anything.... Anyone has any idea???
Thanks in advance.
Related
After fill all the fields , submit button doesn't work and cancel also do nothing.
This function in my _.aspx.cs code:
protected void cancel_Click1(object sender, EventArgs e)
{
Response.Redirect("Home.aspx");}
and this is my aspx code
<%# Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="DonorSignUp.aspx.cs"> Inherits="BloodBank.DonorSignUp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">
Donor Sign Up Page
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="contentBody" runat="server">
<
<h1> DONOR REGISTRATION<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnStr %>" SelectCommand="SELECT * FROM [donor_table]"></asp:SqlDataSource>
</h1>
<table>
<tr>
<td> First Name </td>
<td> <asp:TextBox ID="name" runat="server" Width="139px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="name" ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Last Name</td>
<td> <asp:TextBox ID="last" runat="server" Width="140px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="last" ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
<td>Username</td>
<td><asp:TextBox ID="username" runat="server" Width="176px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="username" ErrorMessage="Please enter the usename"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Password</td>
<td><asp:TextBox ID="password" runat="server" Width="170px" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="password" ErrorMessage="password"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Confirm</td>
<td> <asp:TextBox ID="confirm" runat="server" Width="155px" TextMode="Password"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="password" ControlToValidate="confirm" ErrorMessage="password doesn't match"></asp:CompareValidator>
</td>
</tr>
<tr>
<td colspan="2"><asp:Label ID="msgDSignUp" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="Label2" runat="server" Text="Fill all the blanks"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="SignUpDonor" runat="server" Text="Submit" BackColor="#ff99cc" BorderColor="#ff99cc" OnClick="SignUpDonor_Click1" />
</td>
<td>
<asp:Button ID="cancel" runat="server" Text="Cancel" OnClick="cancel_Click1"/>
</td>
</tr>
</table>
</asp:Content>
When I press cancel button , it does nothing unless I fill all the field in the page ,, if I filled them and press cancel it does the code inside cancel_Click
Can you help me to manipulate this?
This is correct behavior. If you want to test it by going straight to the Cancel event handler, then just comment out all the validators or disable client-side validation temporarily using CausesValidation="false". Validation can occur on both client and server - always best to use both.
Check out this question.
Alright, I have a login page (occurs in register page too) and when I press enter after typing my password to login, it redirects me to the default page but won't do anything else - But when I click the login button, it would login successfully. Why it is happening? Is there a way around it, fixing it?
For example, this is my login.aspx page:
<%# Page Title="התחברות" Language="C#" MasterPageFile="~/MasterPageTest.master" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<br />
<center><b>
<asp:Login ID="Login1" runat="server"
LoginButtonText="התחבר" PasswordLabelText="סיסמא:" TitleText="<u><font size=4>התחברות</font></u>"
UserNameLabelText="שם משתמש:" RememberMeText="זכור אותי"
TextLayout="TextOnTop">
<LayoutTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse:collapse;" dir="rtl">
<tr>
<td>
<table cellpadding="0">
<tr>
<td align="center">
<u><font size="4">התחברות</font></u></td>
</tr>
<tr>
<td>
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">שם משתמש:</asp:Label>
</td>
</tr>
<tr>
<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"><font color="red">*</font></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">סיסמא:</asp:Label>
</td>
</tr>
<tr>
<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"><font color="red">*</font></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="RememberMe" runat="server" Text="זכור אותי" />
</td>
</tr>
<tr>
<td align="center" style="color:Red;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
<tr>
<td align="right">
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="התחבר"
ValidationGroup="Login1" />
<br />
<asp:LinkButton ID="ForgotPassLnk" runat="server" Text="שכחתי סיסמא" OnClick="ForgotPassLnk_Click"></asp:LinkButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>
</b></center>
</asp:Content>
One solution will be:
<asp:TextBox ID="Password" runat="server" TextMode="Password" onkeypress="return EnterEvent(event)"></asp:TextBox>
js
function EnterEvent(e) {
if (e.keyCode == 13) {
//login code
}
}
This is part of my code that isn't working. I have looked for somethings, but i cannot search what my asp:ListView isn't showing, if someone knows about it, Help me !
<asp:ListView ItemPlaceholderID="PlaceHolder1" runat="server" ID="ListViewUser">
<LayoutTemplate>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"/>
<table id="Table1" class="TableListView" runat="server">
<tr id="Tr1" class="TableHeader" runat="server">
<td id="td1" runat="server">Nível</td>
<td id="td2" runat="server">Descrição</td>
<td id="td3" runat="server">Quantidade de Problema ?</td>
<td id="td4" runat="server">Selecionar</td>
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr class="ItemsCSS">
<td>
<asp:Label runat="server"
ID="Label1"
Text="Problema" >
</asp:Label>
</td>
<td>
<asp:Label runat="server"
ID="Label2"
Text="Problema" >
</asp:Label>
</td>
<td>
<asp:Label runat="server"
ID="Label3"
Text="Problema" >
</asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
Your ListView lacks bindings. You can add a DataSourceID property to the top level control and point to a DataSource control or programmatically bind to the DataSource property and then invoke DataBind(). But the control will not display anything without first binding it.
I'm new in ASP.net and started my first Website Project. I want to connect the text box to my table which is "Details" please see the code below:
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<p class="style2">
<br />
DETAILS FORMS</p>
<p>
<table style="width: 100%; height: 117px;">
<tr>
<td class="style4">
<asp:Label ID="Label1" runat="server" Text="ID :"></asp:Label>
</td>
<td class="style3">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style5">
<asp:Label ID="Label2" runat="server" Text="Date Recieved :"></asp:Label>
</td>
<td>
<asp:TextBox ID="DRInput" runat="server"></asp:TextBox>
</td>
<td>
</td>
</tr>
<tr>
<td class="style5">
<asp:Label ID="Label3" runat="server" Text="Date Commision :"></asp:Label>
</td>
<td>
<asp:TextBox ID="DCINput" runat="server"></asp:TextBox>
</td>
<td>
</td>
</tr>
<tr>
<td class="style5">
<asp:Label ID="Label4" runat="server" Text="Sender"></asp:Label>
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
<asp:ListItem>Angeles</asp:ListItem>
<asp:ListItem>Aurora</asp:ListItem>
<asp:ListItem>Bataan</asp:ListItem>
<asp:ListItem>Bulacan</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Database1ConnectionString1 %>"
SelectCommand="SELECT [Sender] FROM [Details]"></asp:SqlDataSource>
</td>
<td>
</td>
</tr>
<tr>
<td class="style10">
</td>
<td class="style11">
<asp:Button ID="Button1" runat="server" Text="Button" />
</td>
<td class="style11">
</td>
</tr>
<tr>
<td class="style6">
</td>
<td class="style7">
</td>
<td class="style7">
</td>
</tr>
</table>
</p>
</asp:Content>
And this is the Code behind it:
public partial class Data : System.Web.UI.Page
{
protected void DRInput_DataBinding(object sender, EventArgs e)
{
}
What would be my code to bind the textbox to save details in my table "Details" and when I click the button it will be save on table "Details" . Hoping anyone could help. Thanks in advance.
In you particular case it doesn't look like you're displaying a list of data but instead the details of an item.
The simple approach would be to assign the text property of the textbox as part of the page request eg within page load event of the page.
DRInput.Text = detailsModel.DRInput;
and then when the page is submitted assign the textbox's text value back to your object.
detailsModel.DRInput = DRInput.Text;
Since you're new to ASP.Net; perhaps best to start with tutorial sites for example w3schools.com/aspnet/aspnet_demo_intro.asp or asp.net/web-forms then come back and ask your questions
When the form is displayed, I'd like to set focus to the CurrentPassword textbox. What is the easiest way to do this? Is there a way to access it directly using its ID? Apparently, because it is nested, referencing the control by its ID results in an unrecognized variable. Alternatively, I could write an ugly FindControl statement (some like) like this:
ChangePassword1.Controls(1).Controls(0).Controls(0).Controls(0).Controls...etc...FindControl("CurrentPassword")
but, besides being ugly, this seems brittle to GUI changes.
I could also write a recursive FindControl statement, but while it is convenient, it is less efficient than a more direct reference.
Suggestions, Ol' Wise Community?
<%# Page Title="" Language="VB" MasterPageFile="~/Master Pages/MasterPage.master" AutoEventWireup="false" CodeFile="ChangePassword.aspx.vb" Inherits="ChangePassword" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="phPageContent">
<h1 style="text-align: left;">
Change Password
</h1>
<hr />
<asp:ChangePassword ID="ChangePassword1" runat="server">
<ChangePasswordTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse: collapse;">
<tr>
<td>
<table cellpadding="2">
<tr>
<td align="right">
<asp:Label ID="CurrentPasswordLabel" runat="server" AssociatedControlID="CurrentPassword" CssClass="CaptionLabel">Current Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="CurrentPassword" runat="server" CssClass="DefaultTextBox" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="CurrentPasswordRequired" runat="server" ControlToValidate="CurrentPassword" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="NewPasswordLabel" runat="server" AssociatedControlID="NewPassword" CssClass="CaptionLabel">New Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="NewPassword" runat="server" CssClass="DefaultTextBox" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="NewPasswordRequired" runat="server" ControlToValidate="NewPassword" ErrorMessage="New Password is required." ToolTip="New Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="ConfirmNewPasswordLabel" runat="server" AssociatedControlID="ConfirmNewPassword" CssClass="CaptionLabel">Confirm New Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="ConfirmNewPassword" runat="server" CssClass="DefaultTextBox" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" ControlToValidate="ConfirmNewPassword" ErrorMessage="Confirm New Password is required." ToolTip="Confirm New Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:CompareValidator ID="NewPasswordCompare" runat="server" ControlToCompare="NewPassword" ControlToValidate="ConfirmNewPassword" Display="Dynamic" ErrorMessage="The Confirm New Password must match the New Password entry." ValidationGroup="ChangePassword1"></asp:CompareValidator>
</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">
<asp:Button ID="ChangePasswordPushButton" runat="server" CommandName="ChangePassword" Text="Submit" ValidationGroup="ChangePassword1" />
</td>
<td>
<asp:Button ID="CancelPushButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</ChangePasswordTemplate>
<MailDefinition BodyFileName="~/EmailTemplates/ChangePassword.htm" From="info-noreply#pandavisa.com" IsBodyHtml="True" Subject="Your password has changed">
</MailDefinition>
</asp:ChangePassword>
</asp:Content>
Based on the reply below, I changed the ClientIdMode of the CurrentPassword Textbox to "Static." I then added the following shown after the pre-existing first line:
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="phPageContent">
<script type="text/javascript">
$().ready(function () {
//$('.DefaultTextBox:eq(0)').focus();
$('#CurrentPassword').focus();
});
</script>
But I got the following error, same error when I uncommented the first suggestion.
Microsoft JScript runtime error: Object expected
You open for some jQuery?
$().ready(function(){
$('.DefaultTextBox:eq(0)').focus();
});
This is an old question, but I'm posting the C# way of referencing the correct textboxes in case anybody looks at this.
TextBox txtCurrentPassword = (TextBox)changepasswordCtl.ChangePasswordTemplateContainer.FindControl("CurrentPassword");
TextBox txtNewPassword = (TextBox)changepasswordCtl.ChangePasswordTemplateContainer.FindControl("NewPassword");
TextBox txtConfirmNewPassword = (TextBox)changepasswordCtl.ChangePasswordTemplateContainer.FindControl("ConfirmNewPassword");