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();
Related
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>
I have added DropDownList1 in Default.aspx page my ASP.Net project, and I have the below code in Default.cs:
if(DropDownList1.SelectedItem.ToString()=="")
I got this error:
Error 2 The name 'DropDownList1' does not exist in the current context
Edit:
In *.cs:
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
string username = Login1.UserName;
string pwd = Login1.Password;
var connstring = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString; ;
var conn = new SqlConnection(connstring);
conn.Open();
SqlCommand command;
if(DropDownList1.SelectedItem.ToString()=="")
command = new SqlCommand("Select [ID] from [Inspector] WHERE [ID] =" + username + " AND [Password] ='" + pwd + "';", conn);
SqlDataReader dr = command.ExecuteReader();
if (dr.Read())
{
if (dr[0].ToString() == username)
{
Session["UserAuthentication"] = username;
Session.Timeout = 1;
Response.Redirect("MainInspector.aspx");
}
else
{
Session["UserAuthentication"] = "";
}
}
}
In *.aspx:
<%# Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent" >
<style type="text/css">
.style1
{
height: 26px;
}
</style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent" >
<h2>
الصفحة الرئيسية</h2>
<p>
الرجاء تسجيل الدخول:</p>
<p>
<asp:Login ID="Login1" runat="server"
FailureText="لم يتم تسجيل دخولك، الرجاء المحاولة ثانية."
LoginButtonText="تسجيل الدخول" onauthenticate="Login1_Authenticate"
PasswordLabelText="كلمة المرور:" RememberMeText="تذكرني في المرات القادمة"
TitleText="نسترعي إنتباهك أن كلمة المرور حساسة لحالة الأحرف"
UserNameLabelText="رقم الهوية:">
<LayoutTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td>
<table cellpadding="0">
<tr>
<td align="center" colspan="2">
نسترعي إنتباهك أن كلمة المرور حساسة لحالة الأحرف</td>
</tr>
<tr dir="rtl">
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">رقم الهوية:</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" class="style1">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">كلمة المرور:</asp:Label>
</td>
<td class="style1">
<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 colspan="2">
تسجيل الدخول بوصفك:<br />
<asp:CheckBox ID="RememberMe" runat="server" Text="تذكرني في المرات القادمة" />
<br />
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
<br />
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="LoginButton" runat="server" CommandName="Login"
Text="تسجيل الدخول" ValidationGroup="Login1" />
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>فاحص</asp:ListItem>
<asp:ListItem>مُدرب</asp:ListItem>
<asp:ListItem>مُتدرب</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>
</p>
</asp:Content>
You need to check your markup to confirm that the ID matches i.e.
<asp:DropDownList id="DropDownList1".....
If it is a web application the designer.cs file could be messed up as this has the reference within it.
Something like this:
protected global::System.Web.UI.WebControls.DropDownList DropDownList1;
If it is missing try adding the above.
Such errors might appear when the markup in the .aspx page (or .ascx control) is not well formed. In cases where the markup is bad, when you add a new control its declaration is not added in the designer file and leads to this error.
If this is the case, one common trick to fix this is to cut and paste the markup of the control. This way you re-add the control and make Visual Studio to re-add the declaration of the control in the designer file.
DropDownList1 does not exist in the current context
The solution for me was to place the DropDownList outside of of the LoginView.
Try moving the DropDownList to another section of your page and see if this works.
i have added modalPopupExtender in my Page and inside that i am calling another page in Iframe. And on button Click i am doing some processing, i just want to know how can i close the modalPopUpExtender on submit click of that button.
My code is -
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" DynamicServicePath="" Enabled="True" PopupControlID="PP"
TargetControlID="btnCounceller" BackgroundCssClass="modalBackground"
CancelControlID="btnclose">
</cc1:ModalPopupExtender>
<asp:Panel ID="PP" runat="server" BackColor="white" Height="200px" Width="350px">
<table class="style1">
<tr>
<td> </td>
<td>
<iframe ID="ff" runat="server" frameborder="0" src="Order.aspx" style="width:350px; height:200px;"></iframe>
</td>
<td>
<asp:Button ID="btnclose" runat="server" Text="X" />
</td>
</tr>
</table>
</asp:Panel>
and My Order.aspx Contains
<table>
<tr>
<td>First Name :</td>
<td><asp:TextBox ID="txtName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Mobile:</td>
<td><asp:TextBox ID="txtMobile" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td><asp:Label ID="lblMessage" runat="server" Visible="false"></asp:Label></td>
</tr>
<tr>
<td></td>
<td><asp:Button ID="btnSubmit" runat="server" Text="Submit"
onclick="btnSubmit_Click" /></td>
</tr>
</table>
Now i just want to close my modalPopUp on click of Submit Button from IFrame
<asp:Panel ID="PP" runat="server" BackColor="white" Height="200px" Width="350px">
<table class="style1">
<tr>
<td> </td>
<td>
<asp:Button ID="btnclose" runat="server" Text="X" OnClick="btnclose_Click" />
</td>
<td>
<iframe ID="ff" runat="server" frameborder="0" src="Order.aspx" style="width:350px; height:200px;"></iframe>
</td>
</tr>
</table>
</asp:Panel>
Protected void btnclose_Click(Object sender, EventArgs e)
{
response.redirect("yourpage.aspx");
}
You can use jQuery as below
$("#btnSubmit").click(function() {
$("#<%= btnclose.ClientID %>").click();
});
This will fire click event of your cancel control btnclose for the modal popup extender on clicking btnSubmit from your iframe. You need to find and replace the actual ID for your iframe button btnSubmit.
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>
I am truing to use a Telerik List View. I just added a SqlDataSource and I want to give the select command at server side. But when i want to access it in .cs file SqlDataSource1 is not accessible even any control is not showing. I added a label when i tried Label1.Text than label1 is not accessible in .cs file.
<%# Page Title="" Language="C#" MasterPageFile="~/PortalSite.Master" AutoEventWireup="true" CodeBehind="category.aspx.cs" Inherits="NoidaPortal.category" %>
<%# Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
.rdpWrap .RadInput, .rdpWrap .rdpPagerButton, .rdpWrap .rdpPagerLabel
{
float: left;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource2" runat="server"></asp:SqlDataSource>
<div>
<!-- content start -->
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function RequestStart(sender, eventArgs) {
//disable ajax on update/insert operation to upload the image
if ((eventArgs.get_eventTarget().indexOf("Update") > -1) || (eventArgs.get_eventTarget().indexOf("PerformInsert") > -1)) {
eventArgs.set_enableAjax(false);
}
}
</script>
</telerik:RadCodeBlock>
<table>
<tr>
<td>
<asp:Panel ID="ListViewPanel1" runat="server">
<telerik:RadListView ID="RadListView1" DataSourceID="SqlDataSource1" runat="server"
ItemPlaceholderID="CustomersContainer" DataKeyNames="ArchitectId" AllowPaging="True"
>
<LayoutTemplate>
<!-- Set the id of the wrapping container to match the CLIENT ID of the RadListView control to display the ajax loading panel
In case the listview is embedded in another server control, you will need to append the id of that server control -->
<fieldset id="FiledSet1" style="width:435px;">
<legend>Customers</legend>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1"
PageSize="5" Width="435px">
<Fields>
<telerik:RadDataPagerButtonField FieldType="FirstPrev" />
<telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="6" />
<telerik:RadDataPagerButtonField FieldType="NextLast" />
<telerik:RadDataPagerPageSizeField PageSizeText="Page size: " />
</Fields>
</telerik:RadDataPager>
</td>
</tr>
</table>
<asp:PlaceHolder ID="CustomersContainer" runat="server" />
<div style="clear: both" />
<br />
<br />
<table style="width: 100%;">
<tr>
<%--<td style="width: 25%;">
<asp:Button ID="btnInitInsert" runat="server" Text="Insert Customer" OnClick="btnInitInsert_Click" />
</td>--%>
<td style="text-align:center; width: 75%;">
<asp:Label ID="lblSort1" runat="server" Text="Sort by:" Style="padding-right: 5px;" />
<telerik:RadComboBox ID="ddListSort" runat="server" AutoPostBack="true">
<Items>
<telerik:RadComboBoxItem Text="-Select field to sort-" Value="" />
<telerik:RadComboBoxItem Text="Company name" Value="ArchitectName" />
<telerik:RadComboBoxItem Text="Sector" Value="Sector" />
</Items>
</telerik:RadComboBox>
</td>
</tr>
</table>
</div>
</fieldset>
</LayoutTemplate>
<ItemTemplate>
<!--The widths/heights of the fieldset/outer tables in the item/edit/insert templates should match to avoid wrapping or visual discrepancies
in the tiles layout-->
<fieldset style="float: left; width: 410px; height: 215px; margin-top:10PX;">
<legend style="font-weight:bold">
<%# Eval("ArchitectName")%></legend>
<table cellpadding="0" cellspacing="0" style="height: 100%;" width="370px">
<tr>
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td style="font-weight:bold; width:25%">
Address:
</td>
<td style="width:auto; width:75%;">
<%#Eval("ArchitectAddress")%>
</td>
</tr>
<tr>
<td style="width:25%; font-weight:">
City:
</td>
<td>
<%# Eval("Contact1")%>
</td>
</tr>
<tr>
<td style="font-weight:bold">
Country:
</td>
<td>
<%# Eval("Contact2")%>
</td>
</tr>
<tr>
<td style="font-weight:bold">
Phone:
</td>
<td>
<%#Eval("Email_Id")%>
</td>
</tr>
<tr>
<td style="font-weight:bold">
Website:
</td>
<td>
<%#Eval("Website")%>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
</ItemTemplate>
<EmptyDataTemplate>
<fieldset style="width: 800px">
<legend>Customers</legend>No records for customers available.
</fieldset>
</EmptyDataTemplate>
</telerik:RadListView>
</asp:Panel>
</td>
</tr>
</table>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbPortalConnectionString %>"
SelectCommand="SELECT * FROM [Architect]" >
</asp:SqlDataSource>
/div>
</form>
</body>
</html>
</asp:Content>
and this is my aspx.cs class
using System;
using System.Collections.Generic;
using System.Collections;
using System.Configuration;
using System.Web.Security;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Data;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace NoidaPortal
{
public partial class category : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
string s = Request.QueryString["cat"];
string s1 = Request.QueryString["sub"];
**I Just want to give here a SqlDataSource.Select command**
}
}
}
Could be possible because you haven't mentioned which is the codebehind for your page. Add this as the first line to your aspx page
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="yourfile.aspx.cs" Inherits="YourProjectName.YourASPXPageName" %>
You have some stuff not allowed in your content placeholder because you're using a master. The reason you're not getting intellisense on your controls is because the page won't complile.
Remove these tags:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<body>
<form id="form1" runat="server">
Then try to compile your app. Fix any errors thrown by the compiler and recompile. Once the application is compilable, your intellisense should start working again.
Yes I found the solution here... I have to convert it to webApplication by right clicking on ProjectFolder and click on "Convert to Web Application". Than it's intellisense start working.