Whenever I try to debug my content page of a master page, another webform which is not a content page runs. I even tried to change the URL after debugging but it didn't work. The URL gets changed automatically.
Please guide me, what could be the problem?
below code is the normal webform which automatically gets run
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Home.aspx.cs" Inherits="Library.Home" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.style1
{
width: 100px;
}
.auto-style1 {
height: 30px;
}
.auto-style2 {
height: 25px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="head">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/digLib.jpg"
Height="95px" />
</div>
<div id="main"><div id="img">
<table class="style1">
<tr>
<td>
</td>
<td>
<asp:Image ID="Image2" runat="server" ImageUrl="~/Images/lib.jpg"
Height="314px"
style="margin-left: 94px" Width="561px" />
</td>
</tr>
</table>
</div>
<div id="login">
<table class="tbl">
<tr>
<td class="tblhead" colspan="2">
Login Area</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Label ID="lbl" runat="server" Font-Size="11px"
ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style1">
UserName :</td>
<td class="auto-style1">
<asp:TextBox ID="txtName" runat="server" CssClass="txt">
</asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server"
ControlToValidate="txtName" ErrorMessage="!!!"
ForeColor="Red"
SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="lbl">
Password :
</td>
<td>
<asp:TextBox ID="txtPass" runat="server" CssClass="txt"
TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
runat="server"
ControlToValidate="txtPass" ErrorMessage="!!!"
ForeColor="Red"
SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
</td>
<td class="auto-style2">
<asp:RadioButton ID="rdolibrary" runat="server"
Checked="True"
ForeColor="Green" GroupName="a" Text="Librarian" />
<asp:RadioButton ID="rdosudent" runat="server" ForeColor="Green"
GroupName="a"
Text="Student" />
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="btnLogin" runat="server" CssClass="btn"
Text="Login"
Width="80px" Font-Size="10pt" OnClick="btnLogin_Click1"
OnClientClick="btnLogin" />
</td>
</tr>
</table>
</div>
</div>
</form>
</body>
</html>
below code is content page of a master page
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master"
AutoEventWireup="true" CodeBehind="AdminPage.aspx.cs"
Inherits="Library.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<asp:Image runat="server" ID="img" ImageUrl="~/Images/lib.jpg" Height="100%"
Width="100%" />
</asp:Content>
below is the master page
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs"
Inherits="Library.Site" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div id="head">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/digLib.jpg"
Width="500px" Height="100px" />
</div><div id="main"><div id="menu">
<table style="width:100%">
<tr>
<td class="tblhead">
welcome
</td>
</tr>
<tr>
<td bgcolor="#FFA76C" style="text-align: center">
<asp:Label ID="lblname" runat="server" ForeColor="#666666">
</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button11" runat="server" CssClass="btnmenu"
Text="ADD PUBLICATION"
PostBackUrl="~/Publication.aspx"
CausesValidation="False"
/>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" CssClass="btnmenu"
Text="ADD BOOK"
PostBackUrl="~/Addbook.aspx" CausesValidation="False" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button2" runat="server" CssClass="btnmenu"
Text="BOOK Report"
CausesValidation="False" PostBackUrl="~/bookreport.aspx"
/>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button3" runat="server" CssClass="btnmenu"
Text="ADD Branch"
PostBackUrl="~/Addbranch.aspx" CausesValidation="False"
/>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button4" runat="server" CssClass="btnmenu"
Text="ADD Student"
PostBackUrl="~/AddStudent.aspx" CausesValidation="False"
/>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button5" runat="server" CssClass="btnmenu"
Text="Student Report" CausesValidation="False"
PostBackUrl="~/Studenteport.aspx" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button6" runat="server" CssClass="btnmenu"
Text="Issue Book"
CausesValidation="False" PostBackUrl="~/BookIssue.aspx"
/>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button7" runat="server" CssClass="btnmenu"
Text="Issue Report" CausesValidation="False"
PostBackUrl="~/Issuereport.aspx" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button8" runat="server" CssClass="btnmenu"
Text="Return Book"
CausesValidation="False" PostBackUrl="~/BookReturn.aspx" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button9" runat="server" CssClass="btnmenu"
Text="Panalty"
CausesValidation="False" PostBackUrl="~/Panalty.aspx" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button10" runat="server" CssClass="btnmenu"
Text="LogOut"
CausesValidation="False" onclick="Button10_Click" />
</td>
</tr>
</table>
</div><div id="detail"> <asp:ContentPlaceHolder
id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder></div></div>
</form>
</body>
</html>
Related
File Upload Not working in update Panel I also tried triggers but it also not working KINDLY RESOVE MY ISSUE
***<%# Page Title="Pharmacy Orders" Theme="DefaultTheme" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="OnlinePharmacyOrders.aspx.cs" Inherits="Forms_Online_OnlinePharmacyOrders" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CPH_Header" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CPH_Menus" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="CPH_Content" runat="Server">
<asp:UpdatePanel ID="UP_PharmacyOrder" runat="server" ChildrenAsTriggers="True" UpdateMode="Conditional">
<ContentTemplate>
<ProgressTemplate>
<div class="UpdateProgress">
<img src="../../App_Themes/DefaultTheme/Images/loading.gif" alt="" class='loadingImg' />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<ajax:TabContainer ID="TC_PharmacyOrders" runat="server" ActiveTabIndex="0" AutoPostBack="true">
<ajax:TabPanel ID="TP_Detail" runat="server" TabIndex="1" Visible="false">
<HeaderTemplate>
Detail
</HeaderTemplate>
<ContentTemplate>
<asp:Panel ID="Pnl_UpdateTrackingNo" runat="server" DefaultButton="Btn_UpdateTrackingNo" Visible="False">
<table class="tblListing">
<tr>
<td colspan="2" class="Heading">Order Detail (Update Tracking / Status) </td>
</tr>
<tr>
<td class="shade">Order No</td>
<td>
<asp:Label ID="Lbl_OrderNoT" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="shade">Ordered Placed By
</td>
<td>
<asp:Label ID="Lbl_OrderByT" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="shade">Contact No
</td>
<td>
<asp:Label ID="Lbl_ContacTNoT" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="shade">Invoice No
</td>
<td>
<asp:Label ID="Lbl_InoviceNoT" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="shade">Delivery Charges
</td>
<td>
<asp:Label ID="Lbl_DeliveryChargesT" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="shade">Invoice Amount
</td>
<td>
<asp:Label ID="Lbl_InvoiceAmountT" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="shade">Delivery Address
</td>
<td>
<asp:Label ID="Lbl_DeliveryAddressT" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="shade">Pharmacy Remarks
</td>
<td>
<asp:Label ID="Lbl_PharmacyRemarksT" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="shade">Status
</td>
<td>
<telerik:RadComboBox ID="Cmb_StatusT" Filter="StartsWith" runat="server" BorderColor="Black" Width="180px" BorderWidth="1px" Skin="Office2010Silver">
<Items>
<telerik:RadComboBoxItem runat="server" Text="Pending" Value="1" />
<telerik:RadComboBoxItem runat="server" Text="Dispatched" Value="2" />
<telerik:RadComboBoxItem runat="server" Text="Cancelled" Value="3" />
<telerik:RadComboBoxItem runat="server" Text="Received by Customer" Value="4" />
<telerik:RadComboBoxItem runat="server" Text="Returned" Value="4" />
</Items>
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td class="shade">Tracking No (if Any)
</td>
<td>
<asp:TextBox ID="TxBx_TrackingNoT" runat="server" ValidationGroup="T"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_TrackingNoT" runat="server" ControlToValidate="TxBx_TrackingNoT" Display="None" ErrorMessage="* Required" ValidationGroup="T"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="RFV_TrackingNoT_ValidatorCalloutExtender" runat="server" Enabled="True" TargetControlID="RFV_TrackingNoT">
</ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" Enabled="True" TargetControlID="RFV_TrackingNo">
</ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td class="shade"> </td>
<td>
<asp:Button ID="Btn_UpdateTrackingNo" runat="server" SkinID="SaveSkin" Text="Save" ValidationGroup="T" Width="100px" OnClick="Btn_UpdateTrackingNo_Click" />
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="Pnl_SaveOrder" runat="server" DefaultButton="Btn_SaveOrder" Visible="False">
<table class="tblListing">
<tr>
<td colspan="2" class="Heading">Order Detail</td>
</tr>
<tr>
<td class="shade">Order No</td>
<td>
<asp:Label ID="Lbl_OrderNo" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="shade">Ordered Placed By
</td>
<td>
<asp:Label ID="Lbl_OrderBy" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="shade">Contact No
</td>
<td>
<asp:Label ID="Lbl_ContacTNo" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="shade">Invoice No
</td>
<td>
<asp:TextBox ID="TxBx_InvoiceNo" runat="server" ValidationGroup="E"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_InvoiceNo" runat="server" ControlToValidate="TxBx_InvoiceNo" Display="None" ErrorMessage="* Required" ValidationGroup="E"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="RFV_InvoiceNo_ValidatorCalloutExtender" runat="server" Enabled="True" TargetControlID="RFV_InvoiceNo">
</ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td class="shade">Prescribed By (Consultant/Dr)
</td>
<td>
<asp:TextBox ID="TxBx_ConsultantName" runat="server" ValidationGroup="E"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_ConsultantName" runat="server" ControlToValidate="TxBx_ConsultantName" Display="None" ErrorMessage="* Required" ValidationGroup="E"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCE_ConsultantName" runat="server" Enabled="True" TargetControlID="RFV_ConsultantName">
</ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td class="shade">Tracking No (if Any)
</td>
<td>
<asp:TextBox ID="TxBx_TrackingNo" runat="server" ValidationGroup="E"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_TrackingNo" runat="server" ControlToValidate="TxBx_TrackingNo" Display="None" ErrorMessage="* Required" ValidationGroup="E"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="RFV_TrackingNo_ValidatorCalloutExtender" runat="server" Enabled="True" TargetControlID="RFV_TrackingNo">
</ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td class="shade">Delivery Charges
</td>
<td>
<asp:TextBox ID="TxBx_DeliveryCharges" CssClass="numeric" runat="server" ValidationGroup="E"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_DeliveryCharges" runat="server" ControlToValidate="TxBx_DeliveryCharges" Display="None" ErrorMessage="* Required" ValidationGroup="E"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="RFV_DeliveryCharges_ValidatorCalloutExtender" runat="server" Enabled="True" TargetControlID="RFV_DeliveryCharges">
</ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td class="shade">Invoice Amount
</td>
<td>
<asp:TextBox ID="TxBx_InvoiceAmount" runat="server" CssClass="numeric" ValidationGroup="E"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_InvoiceAmount" runat="server" ControlToValidate="TxBx_InvoiceAmount" Display="None" ErrorMessage="* Required" ValidationGroup="E"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="RFV_InvoiceAmount_ValidatorCalloutExtender" runat="server" Enabled="True" TargetControlID="RFV_InvoiceAmount">
</ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td class="shade">Delivery Address
</td>
<td>
<asp:TextBox ID="TxBx_DeliverAddress" TextMode="MultiLine" runat="server" Width="400px" Rows="6" ValidationGroup="E"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_DeliverAddress" runat="server" ControlToValidate="TxBx_DeliverAddress" Display="None" ErrorMessage="* Required" ValidationGroup="E"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="RFV_DeliverAddress_ValidatorCalloutExtender" runat="server" Enabled="True" TargetControlID="RFV_DeliverAddress">
</ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td class="shade">Pharmacy Remarks
</td>
<td>
<asp:TextBox ID="TxBx_PharmacyRemarks" TextMode="MultiLine" runat="server" Width="400px" Rows="6" ValidationGroup="E"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_PharmacyRemarks" runat="server" ControlToValidate="TxBx_PharmacyRemarks" Display="None" ErrorMessage="* Required" ValidationGroup="E"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="RFV_PharmacyRemarks_ValidatorCalloutExtender" runat="server" Enabled="True" TargetControlID="RFV_PharmacyRemarks">
</ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td class="shade">Status
</td>
<td>
<asp:DropDownList ID="DDL_Status" runat="server" Width="200px">
<asp:ListItem Text="Pending" Value="1"></asp:ListItem>
<asp:ListItem Text="Dispatched" Value="2"></asp:ListItem>
<asp:ListItem Text="Received" Value="4"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</asp:Panel>
<table class="tblListing">
<tr>
<td class="Heading" colspan="2">Upload Invoice
</td>
</tr>
<tr>
<td class="shade"> Upload Invoice</td>
<td>
<asp:FileUpload ID="File_Uploader" runat="server" />
</td>
</tr>
<tr>
<td class="shade"> </td>
<td>
<asp:Button ID="Btn_SaveOrder" runat="server" SkinID="SaveSkin" Text="Save" ValidationGroup="E" Width="100px" OnClick="Btn_SaveOrder_Click" Height="26px" />
</td>
</tr>
</table>
<table class="tblListing">
<tr>
<td style="text-align: center">
<asp:Image ID="Img_Invoice" runat="server" AlternateText="Invoice" />
</td>
</tr>
</table>
<table class="tblListing">
<tr>
<td colspan="2" class="Heading">Prescription
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center">
<asp:Image ID="Img_Prescription" runat="server" AlternateText="Prescription" />
</td>
</tr>
<tr id="TR_Move" runat="server">
<td runat="server">
<asp:Button Width="100px" ID="Btn_Previouse" runat="server" Text="<< Previouse " CausesValidation="False" SkinID="ShowAllSkin" OnClick="Btn_Previouse_Click" />
</td>
<td runat="server">
<asp:Button ID="Btn_Next" Width="100px" runat="server" Text="Next >>" CausesValidation="False" SkinID="ShowAllSkin" OnClick="Btn_Next_Click" />
</td>
</tr>
</table>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="Btn_SaveOrder" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="CPH_Footer" runat="Server">
</asp:Content>***
I'm getting this error while binding data to data list
too many characters in character literal asp.net
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="android.aspx.cs" Inherits="finalproject.android" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<style type="text/css">
.style1
{
width:900px;
}
.style2
{
width:633px;
text-align:left;
}
.style4
{
width:185px;
text-align:center;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:DataList ID="DataList1" runat="server" DataKeyField="modelid"
style="text-align: center; color: #333333;" RepeatColumns="3"
Width="283px" DataSourceID="SqlDataSource2" CellPadding="3"
BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px"
CellSpacing="1" >
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
<ItemStyle BackColor="#DEDFDE" ForeColor="Black" />
<ItemTemplate>
<br />
<div align="left"></div>
<table cellspacing="1" class="style4" style="border:1px ridge #9900FF">
<tr>
<td style="border-bottom-style:ridge; border-width: 1px; border-color: #000000">
<asp:Label ID="Label1" runat="server" Text="<%# Eval('brand') %>"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:ImageButton ID="ImageButton1" runat="server" Height="252px"
ImageUrl="<%# Image %>" style="margin-left: 0px" />
</td>
</tr>
<tr>
<td>
ModelID<asp:Label ID="Label2" runat="server" Text="<%# Eval('modelid') %>"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
CommandArgument="<%# Bind('ModelID') %>" Text="Add to Cart" Width="100%" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px" />
</td>
</tr>
</table>
<br />
</ItemTemplate>
<SelectedItemStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:VISHConnectionString2 %>"
SelectCommand="SELECT [Image], [modelid], [brand] FROM [adddetails]">
</asp:SqlDataSource>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table align="left" class="style2">
<tr>
<td>
<asp:Label ID="Label3" runat="server" style="color: #333333"></asp:Label>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
I'm getting this error while binding data to data list
too many characters in character literal asp.net
"too many characters in character literal" is caused by having a char-literal with too many characters in it.
You have probably mixed up the '-character and the "-character.
The error probably lies in your "android.aspx.cs"-file rather than the .aspx-file that you have provided.
Could you provide the code for that as well?
Well, your problems are right here:
<%# Bind('ModelID') %>
Replace your single-quotes with double-quotes and you will be golden!
<%# Bind("ModelID") %>
Same goes for all your Evals/Binds
Also see these questions:
Why I'm getting CS1012: "Too many characters in character literal" and CS0019?
Too many characters in character literal?
I think the origin of the error is:
Eval('brand')
It tries to convert brand to a character and fails with that error.
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="android.aspx.cs" Inherits="finalproject.android" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<style type="text/css">
.style1
{
width:900px;
}
.style2
{
width:633px;
text-align:left;
}
.style4
{
width:185px;
text-align:center;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:DataList ID="DataList1" runat="server" DataKeyField="modelid"
style="text-align: center; color: #333333;" RepeatColumns="3"
Width="283px" DataSourceID="SqlDataSource2" CellPadding="3"
BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px"
CellSpacing="1" >
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
<ItemStyle BackColor="#DEDFDE" ForeColor="Black" />
<ItemTemplate>
<br />
<div align="left"></div>
<table cellspacing="1" class="style4" style="border:1px ridge #9900FF">
<tr>
<td style="border-bottom-style:ridge; border-width: 1px; border-color: #000000">
<asp:Label ID="Label1" runat="server" Text="<%# Eval('brand') %>"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:ImageButton ID="ImageButton1" runat="server" Height="252px"
ImageUrl="<%# Image %>" style="margin-left: 0px" />
</td>
</tr>
<tr>
<td>
ModelID<asp:Label ID="Label2" runat="server" Text="<%# Eval('modelid') %>"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
CommandArgument="<%# Bind('ModelID') %>" Text="Add to Cart" Width="100%" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px" />
</td>
</tr>
</table>
<br />
</ItemTemplate>
<SelectedItemStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:VISHConnectionString2 %>"
SelectCommand="SELECT [Image], [modelid], [brand] FROM [adddetails]">
</asp:SqlDataSource>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table align="left" class="style2">
<tr>
<td>
<asp:Label ID="Label3" runat="server" style="color: #333333"></asp:Label>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
I am trying to hide and show text boxes by radio button using jquery. I can show and hide text boxes but the error is I have a drop-down list. When I select drop-down value the page getting refreshed. After page refresh I am unable to do hiding and showing of text boxes. I have update panel for ajax. Why I am unable to hide and show text boxes after page refresh? Here is my source code. Please help me.
<%# Page Title="" Language="C#" MasterPageFile="~/Home.Master" AutoEventWireup="true" CodeBehind="ExperienceADD.aspx.cs" Inherits="Manjilas.WebForm31"%>
<%# Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" tagPrefix="ajax" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<head>
<script src="Scripts2/jquery-1.7-vsdoc.js"></script>
<script src="Scripts2/jquery-1.7.js"></script>
<script src="Scripts2/jquery-1.7.min.js"></script>
<script type="text/javascript">
$(function () {
$('input[name="type"]').on('click', function () {
if ($(this).val() == 'Experienced') {
$('#txtcomp').Show();
$('#txtfrom').Show();
$('#txtto').Show();
} else {
$('#txtcomp').hide();
$('#txtcomp').hide();
$('#txtfrom').hide();
$('#txtto').hide();
}
});
});
</script>
</head>
<div class="container-fluid">
<div class="row-fluid">
<div class="well span5 center login-box">
<div class="alert alert-info">
<b><font size="4">ADD EXPERIENCE DETAILS</font></b>
</div>
<form id="form1" runat="server">
<asp:UpdatePanel ID="updatepanel1" runat="server"><ContentTemplate>
<div>
<ajaxToolkit:ToolkitScriptManager runat="server">
</ajaxToolkit:ToolkitScriptManager>
<asp:UpdatePanel ID="updatepanel2" runat="server"></asp:UpdatePanel>
<fieldset>
<table class="ui-accordion">
<tr>
<td align="left" class="style2">
MachID</td>
<td align="left">
<%-- <div class="input-prepend" title="Select Country Name">--%>
<asp:DropDownList ID="ddid" runat="server" AutoPostBack="True"
onselectedindexchanged="ddid_SelectedIndexChanged">
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="left" class="style2">
<asp:Label ID="Empcode" runat="server" Text="EmpCode"></asp:Label>
<td align="left">
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left" class="style2">
</td>
<td align="left">
<input type="radio" name="type" value="Fresher" />Fresher
<input type="radio" name="type" value="Experienced" />Experienced
</td>
</tr>
<tr>
<td align="left" class="style2">
Company</td>
<td align="left">
<div class="input-prepend" title="Autogenerated District ID" data-rel="tooltip">
<asp:TextBox ID="txtcomp" runat="server" TextMode="SingleLine"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left" class="style2">
From Date</td>
<td align="left">
<div class="input-prepend" title="Enter District Name" data-rel="tooltip">
<asp:TextBox ID="txtfrom" runat="server" TextMode="SingleLine"></asp:TextBox>
<ajax:CalendarExtender ID="Calendarextender1" TargetControlID ="txtfrom" Format="dd/MM/yyyy" runat="server"></ajax:CalendarExtender>
</td>
</tr>
<tr>
<td align="left" class="style2">
To Date</td>
<td align="left">
<div class="input-prepend" title="Enter District Name" data-rel="tooltip">
<asp:TextBox ID="txtto" runat="server" TextMode="SingleLine"></asp:TextBox>
<ajax:CalendarExtender ID="Calendarextender2" TargetControlID ="txtto" Format="dd/MM/yyyy" runat="server"></ajax:CalendarExtender>
</td>
</tr>
<tr>
<td class="style2">
</td>
<td align="left">
<asp:Button ID="Button1" class="btn-primary" runat="server" Text="Add"
Height="36px" Width="74px" onclick="Button1_Click" />
<asp:Button ID="Button2" class="btn-primary" runat="server" Text="Cancel"
Height="36px" Width="74px" PostBackUrl="~/districtDetails.aspx" />
</td>
</tr>
<tr>
<td class="style2">
</td>
<td align="left">
<asp:Label ID="Label2" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</fieldset>
</form>
</div><!--/span-->
</div><!--/row-->
</div>
</div>
</asp:Content>
It's because you're using an UpdatePanel, it will refresh everything inside it's <ContentTemplate>, which in your case has input[name="type"] inside it.
Because it's refreshed, the on('click', function() { isn't binding the current radiobutton with the name="type" anymore, thus make the click never triggered after you select one item inside the dropdown, what you need is to wrap the UpdatePanel only for things that you want to be refreshed or changed only, like this for your case:
<asp:UpdatePanel ID="updatepanel1" runat="server">
<ContentTemplate>
<tr>
<td align="left" class="style2">
MachID
</td>
<td align="left">
<asp:DropDownList ID="ddid" runat="server" AutoPostBack="True"
onselectedindexchanged="ddid_SelectedIndexChanged">
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="left" class="style2">
<asp:Label ID="Empcode" runat="server" Text="EmpCode"></asp:Label>
</td>
<td align="left">
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
</td>
</tr>
</ContentTemplate>
</asp:UpdatePanel>
Other Way
Use the jQuery on click selector, you just need to change
$('input[name="type"]').on('click', function () {
if ($(this).val() == 'Experienced') {
$('#txtcomp').show();
$('#txtfrom').show();
$('#txtto').show();
}
too
$('.ui-accordion').on('click', 'input[name="type"]', function () {
if ($(this).val() == 'Experienced') {
$('#txtcomp').show();
$('#txtfrom').show();
$('#txtto').show();
}
The show function is k senstive. Try this:
$('#txtcomp,#txtfrom,#txtto').show();
Hi I have two usercontrols.
The first user control has a button and the second user control has a popup control.
I registered the second user control in the first user control with id=ctlPopUp
Onclick event of button I have to display the popup control.
I tried with
protected void btnUser_Click(object sender, EventArgs e)
{
var userCtlPopup = ctlPopUp.FindControl("pcDownload");
userCtlPopup.Visible = true;
}
It doesn't work. Can you please suggest?
Hi here is the user control markups:
POpupUsercontrol:
<div id="divDownload" runat="server" visible="true">
<dx:aspxpopupcontrol id="pcDownload" runat="server" showpagescrollbarwhenmodal="true"
clientinstancename="pcDownload" enableclientsideapi="true" modal="True" popuphorizontalalign="WindowCenter"
popupverticalalign="WindowCenter" showheader="false" allowdragging="True" enableanimation="False"
enableviewstate="False" width="600px" autoupdateposition="true" closeaction="CloseButton">
<ContentCollection>
<dx:PopupControlContentControl ID="PopupControlContentControl4" runat="server"
Width="100%">
<dx:ASPxPanel ID="ASPxPanel3" runat="server">
<PanelCollection>
<dx:PanelContent ID="PanelContent4" runat="server">
<div>
<table class="cChildTable">
<tr>
<td>
<h3>Download</h3>
</td>
</tr>
<tr>
<td class="auto-style1">
<div class="hr">
</div>
<asp:Label ID="lblDownLoadMessages" runat="server" CssClass="cMessageArea"></asp:Label>
</td>
</tr>
</table>
<table class="cChildTable" border="0">
<tr><td style="font:bold" colspan="2"><asp:Label ID="Title" runat="server" Text="Content Link Title"></asp:Label></td></tr>
<tr>
<td style="vertical-align: top; width: 30px; padding: 2px" rowspan="8">
<asp:CheckBox ID="chkImg" runat="server" AutoPostBack="True" Checked="true" />
</td>
<td style="vertical-align: top" rowspan="3">
<asp:Image runat="server" ID="imgUpload" Width="100px" Height="100px" Style="top: 0px;" AlternateText="No Image" />
</td>
<td>
<asp:CheckBox ID="chkName" runat="server"
AutoPostBack="true" />
</td>
<td class="cLabel" style="width: 15%">
<asp:Label ID="lblName" runat="server" Text="Name:" Width="90px"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtName" runat="server" CssClass="cText" Width="300px" MaxLength="75"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkCompany" runat="server"
AutoPostBack="true" />
</td>
<td class="cLabel" style="width: 15%">
<asp:Label ID="lblCompany" runat="server" Text="Company:" Width="90px"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtCompany" runat="server" CssClass="cText" Width="300px" MaxLength="75"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkAddress" runat="server"
AutoPostBack="true" />
</td>
<td class="cLabel" style="width: 15%">
<asp:Label ID="lblAddress" runat="server" Text="Address:" Width="90px"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtAddress" runat="server" CssClass="cText" Width="300px" MaxLength="75"></asp:TextBox>
</td>
</tr>
<tr>
<td rowspan="5" style="vertical-align:top"><asp:LinkButton ID="lnkAddImg" runat="server"> </asp:LinkButton></td>
<td>
<asp:CheckBox ID="chkCtyStateZip" runat="server"
AutoPostBack="true" />
</td>
<td class="cLabel" style="width: 15%">
<asp:Label ID="lblCtyStateZip" runat="server" Text="City, State Zip:" Width="90px"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtCtyStateZip" runat="server" CssClass="cText" Width="300px" MaxLength="75"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkPhone" runat="server"
AutoPostBack="true" />
</td>
<td class="cLabel" style="width: 15%">
<asp:Label ID="lblPhone" runat="server" Text="Phone:" Width="90px"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtPhone" runat="server" CssClass="cText" Width="150px" MaxLength="75"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkFax" runat="server"
AutoPostBack="true" />
</td>
<td class="cLabel" style="width: 15%">
<asp:Label ID="lblFax" runat="server" Text="Fax:" Width="90px"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtFax" runat="server" CssClass="cText" Width="150px" MaxLength="75"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkEmail" runat="server"
AutoPostBack="true" />
</td>
<td class="cLabel" style="width: 15%">
<asp:Label ID="lblEmail" runat="server" Text="Email:" Width="90px"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtEmail" runat="server" CssClass="cText" Width="150px" MaxLength="75"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkOther" runat="server"
AutoPostBack="true" />
</td>
<td class="cLabel" style="width: 15%">
<asp:Label ID="lblOther" runat="server" Text="Other:" Width="90px "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtOther" runat="server" CssClass="cText" Width="150px" MaxLength="75"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="4">
<div class="buttons">
<span id="span2" class="cBtnLeft"><span class="cBtnMid"><span class="cBtnRight">
<asp:Button ID="btnDownLoad" runat="server" Width="65px" CssClass="cBtnRight" Text="Download"
OnClick="btnDownLoad_Click"/>
</span></span></span><span id="span1" class="cBtnLeft"><span class="cBtnMid"><span
class="cBtnRight">
<asp:Button ID="btnCancel" runat="server" Width="65px" CssClass="cBtnRight" Text="Cancel"
Visible="true" OnClick="btnCancel_Click" />
</span></span></span>
</div>
</td>
</tr>
</table>
</div>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxPanel>
</dx:PopupControlContentControl>
</ContentCollection>
</dx:aspxpopupcontrol>
</div>
Usercontrol where the popup user control is called
<asp:Panel runat="server" ID="pnlCategoryDetail" Width="100%">
<dx:ASPxDataView ID="dvMARCCategoryDetail" runat="server" Width="100%"
ClientInstanceName="dvMARCCategoryDetail" style="clear: both" ColumnCount="2" RowsPerPage="2" OnPageIndexChanged="dvMARCCategoryDetail_PageIndexChanged">
<itemtemplate>
<table>
<tbody>
<tr>
<td>
<table>
<tr>
<td>
<asp:Image ID="ModelImage" runat="server" ImageUrl='<%#Eval("ImageUrl") %>'>
</asp:Image>
</td>
<td>
<div style="width: 5px" class="Spacer">
</div>
</td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<td>
<asp:Label ID="ModelLabel" runat="server" Text='<%# Eval("DocumentName") %>' Font-Bold="True"
>
</asp:Label></td>
</tr>
<tr>
<td style="text-align:left;padding-bottom:1em;">
<asp:Label ID ="txtText1" runat="server" Text="The May edition of News Brief contains seven newsworthy articles"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID ="txtText2" runat="server" Text="Suggested Subject Line: The May 2014 News Brief has arrived!"></asp:Label>
</td>
</tr>
<tr>
<td style="white-space:nowrap;">
<a id="clink2" style="width:60px">Content Link 1</a>
<asp:ImageButton ID="ImageButton2" runat="server" OnClick="btnArrow_Click" ImageUrl="~/Images/DownloadArrow.png" ToolTip="Download Item" style="padding-top:8px"/>
<asp:ImageButton ID="ImageButton1" runat="server" OnClick="btnAdd_Click" ImageUrl="~/Images/Add.png" ToolTip="Add Item" style="padding-top:8px"/>
</td>
<td> </td></tr>
</table>
</td>
</tr>
</tbody>
</table>
</itemtemplate>
<paddings padding="0px" />
<itemstyle height="50px">
</itemstyle>
</dx:ASPxDataView>
</asp:Panel>
<div id="divCategoryPopup" runat="server">
<downloadPopUp:categoryPopup id="ctlPopUp" runat="server"></downloadPopUp:categoryPopup>
</div>
On click of btnArrow_Click the popup user control should be displayed
Problem,, i am not getting partial page post page,, instead i get full page reload and then i get the next 4 rows inside table on button click. any idea why i am not getting Ajax functionality.
I am working in Content Page.
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" >
<ContentTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="35%">Last Degree</th>
<th width="35%">Institute</th>
<th width="20%">Year</th>
<th width="30%">Majors</th>
</tr>
<tr id="rowFields">
<td>
<asp:TextBox runat="server" ID="txtDegree" type="text" onblur="if(this.value=='' || this.value==null) this.value=''"
onfocus="if(this.value==''){this.value='';}" placeholder="Last Degree*" size="35" />
</td>
<td>
<asp:TextBox runat="server" ID="txtInstitue" type="text" onblur="if(this.value=='' || this.value==null) this.value=''"
onfocus="if(this.value==''){this.value='';}" placeholder="Institute*" size="35" />
</td>
<td>
<asp:TextBox runat="server" ID="txtYear" onblur="if(this.value=='' || this.value==null) this.value=''"
onfocus="if(this.value==''){this.value='';}" Placeholder="Year*" size="12" />
</td>
<td>
<asp:TextBox runat="server" ID="txtSubjects" onblur="if(this.value=='' || this.value==null) this.value=''"
onfocus="if(this.value==''){this.value='';}" placeholder="Subjects*" size="35" />
</td>
</tr>
<tr>
<td>
<asp:PlaceHolder ID="PlaceHolderEdu" runat="server"></asp:PlaceHolder>
</td>
<td>
<asp:PlaceHolder ID="PlaceHolderEdu2" runat="server"></asp:PlaceHolder>
</td>
<td>
<asp:PlaceHolder ID="PlaceHolderEdu3" runat="server"></asp:PlaceHolder>
</td>
<td>
<asp:PlaceHolder ID="PlaceholderEdu4" runat="server"></asp:PlaceHolder>
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="addmoreEdu" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:LinkButton ID="addmoreEdu" runat="server" CssClass="linkbutton"
onclick="addmoreEdu_Click" CausesValidation="False">Add More</asp:LinkButton>
</div>