Search Results

Search found 1705 results on 69 pages for 'runat'.

Page 4/69 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to detect if Asp.Net form is valid

    - by Hasan Gürsoy
    Hi, I have a form which is in an updatePanel and I have a span with hidden loading image, which I want to show when user clicks to submit button but I first need to check if page is valid on client side. Also I'm making loading span visible with jQuery. Here is my code: <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> function showLoading() { $('#loader').show(); } </script> </head> <body> <asp:ScriptManager ID="smMain" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="upForm" runat="server"> <ContentTemplate> <asp:MultiView ID="mvContact" runat="server" ActiveViewIndex="0"> <asp:View ID="vDefault" runat="server"> <asp:TextBox ID="tEMail" runat="server" CssClass="input" /> <asp:RequiredFieldValidator ID="rfvEMail" runat="server" ControlToValidate="tEMail" ErrorMessage="* required" Display="Dynamic" /> <asp:RegularExpressionValidator ID="revEMail" runat="server" ControlToValidate="tEMail" ErrorMessage="* invalid" Display="Dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" /> <asp:ImageButton ID="btnSubmit" runat="server" ImageUrl="~/Assets/Images/btnSubmit.png" ToolTip="Submit Form" style="margin:5px 5px 0 -5px" onclick="btnSubmit_Click" OnClientClick="showLoading();" /> <span id="loader"><img src="Assets/Images/loader.gif" title="Sending..." /></span> </asp:View> <asp:View ID="vResult" runat="server"> <div class="result"> <span id="lResult" runat="server">Your message is sent</span> </div> </asp:View> </asp:MultiView> </ContentTemplate> </asp:UpdatePanel> </body></html>

    Read the article

  • Ajax Tabs implementation problem .

    - by SmartDev
    Hi , I have Implement ajax tabs and i have four tabs in it . In the four tabs i have four grid views with paging and sorting .The tabs are looking good i can see the grid ,but the problem is my first tab sorting works fine, where if i click on any other tab and click on the grid it goes to my first tab again . One more thing i want to change the background color of each tab. Can anyone help please here is my source code: <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScMMyTabs" runat="server"> </asp:ScriptManager> <cc1:TabContainer ID="TCMytabs" ActiveTabIndex="0" runat="server"> <cc1:TabPanel ID="TpMyreq" runat="server" CssClass="TabBackground" HeaderText="My request"> <ContentTemplate> <table> <tr> <td> <asp:Button ID="btnexportMyRequestCsu" runat="server" Text="Export To Excel" CssClass="LabelDisplay" OnClick="btnexportMyRequestCsu_Click" /> </td> </tr> <tr> <td> <asp:GridView ID="GdvMyrequest" runat="server" CssClass="Mytabs" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" GridLines="None" OnPageIndexChanging="GdvMyrequest_PageIndexChanging" OnSorting="GdvMyrequest_Sorting" EmptyDataText="No request found for this user"> <RowStyle BackColor="#DEDFDE" ForeColor="Black" /> <FooterStyle BackColor="#C6C3C6" ForeColor="Black" /> <PagerStyle BackColor="Control" ForeColor="Gray" HorizontalAlign="Left" /> <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" /> <PagerSettings Position="TopAndBottom" /> <Columns> <asp:TemplateField> <HeaderTemplate> Row No </HeaderTemplate> <ItemTemplate> <%# Container.DataItemIndex + 1 %> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </td> </tr> <tr> <td> <asp:Label ID="lblmessmyrequestAhk" runat="server" CssClass="labelmess"></asp:Label> </td> </tr> </table> </ContentTemplate> </cc1:TabPanel> <cc1:TabPanel ID="TpMyPaymentCc" runat="server" HeaderText="Payments Credit Card" > <ContentTemplate> <table> <tr> <td> <asp:GridView ID="GdvmypaymentsCc" runat="server" CssClass="Mytabs" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" GridLines="None" OnPageIndexChanging="GdvmypaymentsCc_PageIndexChanging" OnSorting="GdvmypaymentsCc_Sorting" EmptyDataText="No Data"> <RowStyle BackColor="#DEDFDE" ForeColor="Black" /> <FooterStyle BackColor="#C6C3C6" ForeColor="Black" /> <PagerStyle BackColor="Control" ForeColor="Gray" HorizontalAlign="Left" /> <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" /> <PagerSettings Position="TopAndBottom" /> </asp:GridView> </td> </tr> <tr> <td> <asp:Label ID="lblmessmypaymentsCsu" runat="server" CssClass="labelmess"></asp:Label> </td> </tr> </table> </ContentTemplate> </cc1:TabPanel> <cc1:TabPanel ID="TpMyPaymentsCk" runat="server" HeaderText="Payments Check" > <ContentTemplate> <asp:GridView ID="GdvmypaymentsCk" runat="server" CssClass="Mytabs" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" GridLines="None" OnPageIndexChanging="GdvmypaymentsCk_PageIndexChanging" OnSorting="GdvmypaymentsCk_Sorting" EmptyDataText="No Data"> <RowStyle BackColor="#DEDFDE" ForeColor="Black" /> <FooterStyle BackColor="#C6C3C6" ForeColor="Black" /> <PagerStyle BackColor="Control" ForeColor="Gray" HorizontalAlign="Left" /> <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" /> <PagerSettings Position="TopAndBottom" /> </asp:GridView> </ContentTemplate> </cc1:TabPanel> <cc1:TabPanel ID="TpMyCalls" runat="server" HeaderText="Calls" > <ContentTemplate> <table> <tr> <td> <asp:GridView ID="GdvSelectcallsP" runat="server" CssClass="Mytabs" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" GridLines="None" OnPageIndexChanging="GdvSelectcallsP_PageIndexChanging" OnRowDataBound="GdvSelectcallsP_RowDataBound" OnSorting="GdvSelectcallsP_Sorting" > <RowStyle BackColor="#DEDFDE" ForeColor="Black" /> <FooterStyle BackColor="#C6C3C6" ForeColor="Black" /> <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" /> <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" /> <Columns> <asp:TemplateField> <HeaderTemplate> Row No </HeaderTemplate> <ItemTemplate> <%# Container.DataItemIndex + 1 %> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </td> </tr> <tr> <td> <asp:Label ID="lblmessselectcallsAhkP" runat="server" CssClass="labelmess"></asp:Label> </td> </tr> </table> </ContentTemplate> </cc1:TabPanel> </cc1:TabContainer> </asp:Content>

    Read the article

  • How to use an UpdatePanel inside a Reapeater ItemTemplate with a HTML Table

    - by vanslly
    I want to allow the user to edit by data by row, so only need content updated by row. I managed to achieve this by using a Repeater with a UpdatePanel in the ItemTemplate. Using a div <asp:ScriptManager ID="ctlScriptManager" runat="server" /> <asp:Repeater ID="ctlMyRepeater" runat="server"> <ItemTemplate> <div> <asp:UpdatePanel ID="ctlUpdatePanel" runat="server"> <ContentTemplate> <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' /> <asp:LinkButton ID="btnRename" runat="server" CommandArgument='<%# Eval("ID") %>' CommandName="Rename">Rename...</asp:LinkButton> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="btnRename" EventName="Click" /> </Triggers> </asp:UpdatePanel> </div> </ItemTemplate> </asp:Repeater> But, I want to use a table to ensure structure and spacing and CSS styling wasn't doing it for me, but when I use a table everything goes whacky. Using a Table <asp:ScriptManager ID="ctlScriptManager" runat="server" /> <table> <asp:Repeater ID="ctlMyRepeater" runat="server"> <ItemTemplate> <asp:UpdatePanel ID="ctlUpdatePanel" runat="server"> <ContentTemplate> <tr> <td> <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' /> </td> <td> <asp:LinkButton ID="btnRename" runat="server" CommandArgument='<%# Eval("ID") %>' CommandName="Rename">Rename...</asp:LinkButton> </td> </tr> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="btnRename" EventName="Click" /> </Triggers> </asp:UpdatePanel> </ItemTemplate> </asp:Repeater> </table> What's the best way to solve this problem? I prefer using a table, because I really want to enfore structure without reliance on CSS. Thanks in advance.

    Read the article

  • Accessing Content Page elements

    - by Abdel Olakara
    Hi all, I am facing a strange problem.. may be i am overlooking something and not able to find the silly issue. Need your help! I have a Master page and a Content Page: <form id="AccountForm" runat="server"> <div> <asp:ContentPlaceHolder ID="MenuHolder" runat="server"> </asp:ContentPlaceHolder> </div> <hr /> <div> <asp:ContentPlaceHolder ID="ContentHolder" runat="server"> </asp:ContentPlaceHolder> </div> And my content page has some form elements: <asp:Content ID="Content3" ContentPlaceHolderID="ContentHolder" runat="server"> First Name: <asp:TextBox ID="fName" runat="server"></asp:TextBox> <br /> Middle Name: <asp:TextBox ID="mName" runat="server"></asp:TextBox> <br /> Family Name: <asp:TextBox ID="lName" runat="server"></asp:TextBox> <br /> Birthday: <asp:TextBox ID="birthday" runat="server"></asp:TextBox> <br /> Mobile Phone: <asp:TextBox ID="mobile" runat="server"></asp:TextBox> <br /> Alternate Phone: <asp:TextBox ID="phone" runat="server"></asp:TextBox> <br /> I also have the code for submit button in the content page where i try to retrieve the values from the form elements and persist it into DB. Here is the SubmitButton_Click code: protected void SubmitButton_Click(object sender, EventArgs e) { log.Info("From Submit button: " + customerObject.first_name + " " + customerObject.family_name); if (fName != null) log.Info("First Name is not null"); log.Info("First Name:" + fName.Text); log.Info("Middle Name:" + mName.Text); log.Info("Family Name:" + fName.Text); log.Info("Mobile:" + mobile.Text); log.Info("Phone: " + phone.Text); log.Info("Address:" + bAddressL1.Text + bAddressL2.Text); Strangly.. i don't get any data that is filled into my text fields? Their objects are not null as well!! why is this behaviour happening? I am not trying to access elements in master page or other.. all the fields are in the content page.. only thing is there is no form element in the content page and the form element is in master page! Thanks in advance for your suggestions and answers. Abdel Raoof Olakara

    Read the article

  • Cannot use 'javascript' because another language has been specified earlier in this page (or was implied from a CodeFile attribute).

    - by klm9971
    Hello: I have a website in which I am including a javascript file from this link: Code Snippet Page I am getting this error: Microsoft JScript runtime error: Object expected Here is my code: <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ATP_Assignment.Default" %> <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="topArea" runat="server"> <div> <div id="matchUp" class="floatLeft"> <div class="tabTop"> <div class="tabTL"></div> <div class="tabTM"> <font class="title">Player Matchup History</font> </div> <div class="tabTR"></div> </div> <div class="tabMiddle"> <asp:DropDownList ID="ddlPlayer1" runat="server" Height="16px" Width="146px" DataTextField="Name" DataValueField="Id"> </asp:DropDownList> &nbsp;&nbsp;VS&nbsp;&nbsp; <asp:DropDownList ID="ddlPlayer2" runat="server" Height="16px" Width="150px" DataTextField="Name" DataValueField="ID"> </asp:DropDownList> <asp:Button ID="Button1" runat="server" Text="Click" onclick="Button1_Click" /> <br /> Player1: <asp:Label ID="lblPlayer1Score" Value="" runat="server"></asp:Label>&nbsp;&nbsp; Player2: <asp:Label ID="lblPlayer2Score" Value="" runat="server"></asp:Label> </div> <div class="tabBottom"> <div class="tabBL"></div> <div class="tabBM"></div> <div class="tabBR"></div> </div> </div> <div id="favList" class="floatLeft"> <div class="tabTop2"> <div class="tabTL"></div> <div class="tabTM2"> <font class="title">Favorite Player List</font> </div> <div class="tabTR"></div> </div> <div class="tabMiddle2"> Enter Fav JQuery Here!!! </div> <div class="tabBottom2"> <div class="tabBL"></div> <div class="tabBM2"></div> <div class="tabBR"></div> </div> </div> <div class="clearFix">&nbsp;</div> </div> </asp:Content> <asp:Content ID="Content3" ContentPlaceHolderID="contentArea" runat="server"> <div class="padding"> <div> <div id="playerList" class="floatLeft"> <font class="title">Player List</font> <br /> <asp:DataList ID="PlayerList" runat="server"> <ItemTemplate> Name: <asp:Label ID="lblFirstName" runat="server" Text='<%# Eval("FirstName") %>' /> &nbsp; <asp:Label ID="lblLastName" runat="server" Text='<%# Eval("LastName") %>' /> <br /> Rank: <asp:Label ID="lblRank" runat="server" Text='<%# Eval("Rank") %>' /> <br /> Country: <asp:Label ID="lblCountry" runat="server" Text='<%# Eval("Country") %>' /> <br /> <br /> </ItemTemplate> </asp:DataList> </div> <div class="smallPadding">&nbsp;</div> <div id="video"> </div> <div class="clearFix">&nbsp;</div> </div> <div id="tweet"> <font class="title">Recent Tweets</font> <br /> <script type="text/javascript"> alert($ && $.fn ? $.fn.jquery : "jQuery not defined") $(function () { $("#favorites").tweet({ avatar_size: 32, count: 3, username: "atpworldtour", favorites: true, loading_text: "loading list..." }); }); </script> </div> </div> </asp:Content> Where should I put this code: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>

    Read the article

  • JavaScript Intellisense with Telerik in ASP.NET Master Page Project with VS 2010

    - by Otto Neff
    Today I was looking for a solution to get finally the JScript/Javascript/jQuery Intellisense Featureworking with my ASP.Net Webform Project to work. I found some good articles: - JScript IntelliSense Overview- JScript IntelliSense: A Reference for the “Reference” Tag- Enabling JavaScript intellisense in VS.NET 2010 to work with SharePoint 2010- Rich IntelliSense for jQueryBUT, all of suggested solutions did not work right with my Master Page based Visual Studio 2010 Solution.Only with physical Javascript Files (Telerik includes certain Javascript Files like jQuery as Ressource) or/andconfigure always a new ASP.NET Scriptmanager / RadScriptManager on every page derived from the Master Page, wasn't exactly what I was looking for. So I came up with the following simple Solution, to Trick VS2010and still have the Project running with multiple runat="server" Scriptmanagers. In short:- New ASP.NET control derived from ScriptManager with emtpy overwritten OnInit() to use it as emtpy wrapper for VS2010. In detail:New RadScriptManager Classusing System; using System.Collections.Generic; using System.Linq; using System.Web; using Telerik.Web.UI; namespace IntellisenseJavascript.Controls { public class IntelliJS : RadScriptManager { protected override void OnInit(EventArgs e) { } protected override void OnPreRender(EventArgs e) { } protected override void OnLoad(EventArgs e) { } protected override void Render(System.Web.UI.HtmlTextWriter writer) { } public override void RenderControl(System.Web.UI.HtmlTextWriter writer) { } } } web.config<configuration> ... <system.web> ... <pages> <controls> <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/> <add tagPrefix="VSFix" namespace="IntellisenseJavascript.Controls" assembly="IntellisenseJavascript"/> </controls> </pages> ... Master Page<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="IntellisenseJavascript.Site" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html > <head id="head" runat="server"> <title></title> <telerik:RadStyleSheetManager ID="radStyleSheetManager" runat="server" /> </head> <body> <form id="form" runat="server"> <telerik:RadScriptManager ID="radScriptManager" runat="server"> <Scripts> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.Core.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.jQuery.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.jQueryInclude.js" /> </Scripts> </telerik:RadScriptManager> <telerik:RadAjaxManager ID="radAjaxManager" runat="server"> </telerik:RadAjaxManager> <div> #MASTER CONTENT# <asp:ContentPlaceHolder ID="contentPlaceHolder" runat="server"> </asp:ContentPlaceHolder> </div> </form> <script type="text/javascript"> $(function () { // Masterpage ready $('body').css('margin', '50px'); }); </script> </body> </html> ASPX Page<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="IntellisenseJavascript.Default" %> <asp:Content ID="Content1" ContentPlaceHolderID="contentPlaceHolder" runat="server"> <VSFix:IntelliJS runat="server" ID="intelliJS"> <Scripts> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.Core.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.jQuery.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.jQueryInclude.js" /> </Scripts> </VSFix:IntelliJS> <div style="border: 5px solid #FF9900;"> #PAGE CONTENT# </div> <script type="text/javascript"> $(function () { // Page ready $('body').css('border', '5px solid #888'); }); </script> </asp:Content> The Result I know, this is not the way it meant to be... but now at least you can have a Main ScriptManager for all Common Scripts and Settings, inject page specific Javascripts in PageLoad Event in normal ASPX Files and have JavaScript Intellisense for defined Scripts from JS Files or Assembly Ressouce in your Content Maybe, vNext will fix this.

    Read the article

  • Hidden Field losing its Value on postback

    - by Ratan
    I have a ascx page where I am using a hidden field to store the value of a the drop down box as it is generated using a google address finder. My problem is that when I try to store the value directly in the hidden field : hfDdlVerifyID.Value = ddlVerifySS.SelectedValue; in the event of a button click, the value is stored but on postback is lost again. Whereas, if i try to use Scriptmanager to do it, nothing is stored. getBuild.AppendLine("$get('" + hfDdlVerifyID.ClientID + "').value = $get('" + ddlVerifySS.ClientID + ").value;"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "storeHidden", getBuild.ToString(), true); // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "storeHidden", getBuild.ToString(), true); string test = hfDdlVerifyID.Value.ToString(); The ascx page is : <asp:UpdatePanel ID = ddlUpdate runat="server"> <ContentTemplate> <asp:Panel ID="pVerify" runat="server"> <br /> <fieldset> <legend> <asp:Literal ID="lVerify" runat="server" /> </legend> <asp:CheckBox ID ="cbVerify" runat ="server" Text ="Use the value from the following list, (Uncheck to accept address as it is)." Checked ="true" /> <br /> <asp:DropDownList ID="ddlVerifySS" runat="server" onselectedindexchanged="ddlVerifySS_SelectIndexChange" /> <asp:HiddenField id ="hfDdlVerifyID" runat ="server" /> </fieldset> </asp:Panel> </ContentTemplate> </asp:UpdatePanel> <padrap:Button ID ="bVerify" runat ="server" CssClass ="btn" OnClick ="bVerify_Click" Text ="Verify Address" /> <asp:Button ID ="btnSubSite" runat ="server" text ="Save" CssCLass ="btn" OnClick ="save_btn_Click_subSite" onLoad="ddlVerify_Load" />

    Read the article

  • How to avoid an asp:Multiview to load all the views

    - by GigaPr
    Hi I have a multiview control on my page and a menu to create a tab control <asp:Menu ID="tabMenu" Orientation="Horizontal" StaticMenuItemStyle-CssClass="tab" StaticSelectedStyle-CssClass="selectedTab" CssClass="tabs" OnMenuItemClick="Menu1_MenuItemClick" runat="server"> </asp:Menu><asp:MultiView ID="multiViewTab" ActiveViewIndex="0" runat="server"> <asp:View ID="viewDetails" runat="server"> <uc:ViewDetails runat="server" ID="ucViewDetails" /> </asp:View> <asp:View ID="viewJobs" runat="server"> <uc:ViewJob ID="ucViewJob" runat="server" /> </asp:View> <asp:View ID="viewJobList" runat="server"> <uc:ViewJobList ID="ucViewJobList" runat="server" /> </asp:View> </asp:MultiView> and i set the current view as follow protected void Menu1_MenuItemClick(object sender, MenuEventArgs e) { int index = Int32.Parse(e.Item.Value); if (index != 0) { tabMenu.FindItem("0").Selected = false; } multiViewTab.ActiveViewIndex = index; } it works well ... the only problem is that each time i click on a view all the views are loaded.while i would like to load only the one which is active Do you know any way to avoid the loading of all the views?

    Read the article

  • asp.net ajax + http module fails

    - by Sri Kumar
    Hi, I am trying my hands on asp.net+ajax+httpmodule. My Form <form id="LoginForm" runat="server"> <asp:ScriptManager ID="LoginScriptMgr" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="LoginPanel" runat="server"> <ContentTemplate> <asp:Label ID="lblLoginHeader" Text="Login" runat="server"></asp:Label> <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox> <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox> <asp:Button ID="btnLogin" Text="Login" runat="server" OnClick="Login" /> <asp:Label ID="lblLoginStatus" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </form> C# Code protected void Login(object sender, EventArgs e) { lblLoginStatus.Text = "Login Successful"; } Web.config <httpModules> <add name="TimeModule" type="MyWebPortal.App_Code.TimeModule,App_Code"/> </httpModules> HTTP Module public class TimeModule : IHttpModule { private HttpApplication oApps = null; public void Dispose() { } public void Init(System.Web.HttpApplication context) { oApps = context; context.PreSendRequestContent += new EventHandler (context_PreSendRequestContent); } void context_PreSendRequestContent(object sender, EventArgs e) { string message = "&lt;!-- This page is being processed at " + System.DateTime.Now.ToString() + " -->"; oApps.Context.Response.Output.Write(message); } } When i remove the TimeModule from Web.config my ajax works. If add the TimeModule then the label doesn't show the message "Login Successful". Removing the ajax panel and with httpmodule available the label shows the message. So, how ajax panel was related to httpmodules?

    Read the article

  • How can I format the text in a databound TextBox?

    - by Abe Miessler
    I have ListView that has the following EditItemTemplate: <EditItemTemplate> <tr style=""> <td> <asp:LinkButton ID="UpdateButton" runat="server" CommandName="Update" Text="Update" /> <asp:LinkButton ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" /> </td> <td> <asp:TextBox ID="FundingSource1TextBox" runat="server" Text='<%# Bind("FundingSource1") %>' /> </td> <td> <asp:TextBox ID="CashTextBox" runat="server" Text='<%# Bind("Cash") %>' /> </td> <td> <asp:TextBox ID="InKindTextBox" runat="server" Text='<%# Bind("InKind") %>' /> </td> <td> <asp:TextBox ID="StatusTextBox" runat="server" Text='<%# Bind("Status") %>' /> </td> <td> <asp:TextBox ID="ExpectedAwardDateTextBox" runat="server" Text='<%# Bind("ExpectedAwardDate","{0:MM/dd/yyyy}) %>' onclientclick="datepicker()" /> </td> </tr> </EditItemTemplate> I would like to format the "ExpectedAwardDateTextBox" so it shows a short date time but haven't found a way to do this without going into the code behind. In the Item template I have the following line to format the date that appears in the lable: <asp:Label ID="ExpectedAwardDateLabel" runat="server" Text='<%# String.Format("{0:M/d/yyyy}",Eval("ExpectedAwardDate")) %>' /> And I would like to find a similar method to do with the insertItemTemplate.

    Read the article

  • C#: Formview doesn't change Mode

    - by Vinzcent
    Hey When I try to change my formview to Edit, he stays in de ReadOnlyMode. I can't figure out why. This is my code. <asp:FormView ID="fvDetailOrder" runat="server" AllowPaging="True" DataKeyNames="ID" OnModeChanging="fvDetailOrder_ModeChanging"> <EditItemTemplate> // I want to see this, when I click edit <asp:LinkButton ForeColor="#003366" ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" /> &nbsp;<asp:LinkButton ForeColor="#003366" ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </EditItemTemplate> <InsertItemTemplate> Insert here <asp:LinkButton ForeColor="#003366" ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" /> &nbsp;<asp:LinkButton ForeColor="#003366" ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </InsertItemTemplate> <ItemTemplate> Read only <asp:LinkButton ForeColor="#003366" ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" /> &nbsp;<asp:LinkButton ForeColor="#003366" ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you certain you want to delete this product?');" /> &nbsp;<asp:LinkButton ForeColor="#003366" ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New" /> </ItemTemplate> <PagerStyle ForeColor="#003366" /> </asp:FormView> Eventhandler protected void fvDetailOrder_ModeChanging(Object sender, FormViewModeEventArgs e) { fvDetailOrder.ChangeMode(e.NewMode); } Thanks, Vincent

    Read the article

  • Issue with dynamically loading a user control on button click

    - by Kumar
    I have a page in which I am loading a user control dynamically as follows: Default.aspx: <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </cc1:ToolkitScriptManager> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> Default.aspx.cs: protected void Page_Load(object sender, EventArgs e) { var ctrl = LoadControl("~/UserCtrl1.ascx"); ctrl.ID = "ucUserCtrl1"; PlaceHolder1.Controls.Add(ctrl); } Below is the code for UserCtrl1.ascx <asp:Label ID="Label1" runat="server"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" /> <br /> <asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder> I am dynamically loading another user control when the Button1 is clicked UserCtrl1.ascx.cs protected void Button1_Click(object sender, EventArgs e) { Label1.Text = "UserControl - 1 button clicked!"; var ctrl = LoadControl("~/UserCtrl2.ascx"); ctrl.ID = "ucUserCtrl2"; PlaceHolder2.Controls.Add(ctrl); } Below is the markup for UserCtrl2.ascx <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label2" runat="server"></asp:Label> <asp:Button ID="Button2" runat="server" Text="Button2" OnClick="Button2_Click" /> </ContentTemplate> </asp:UpdatePanel> UserCtrl2.ascx.cs protected void Button2_Click(object sender, EventArgs e) { Label2.Text = "UserControl - 2 button clicked!"; } After the page loads when I click the Button1 in UserCtrl1 the click event fires and I am able to see the Label1 text. It also properly loads the UserCtrl2, but when I click the Button2 in UserCtrl2 the click event dosent fire and even worse when I click the Button2 twice the UserCtrl2 control dissappears from the page. How can I fix this?

    Read the article

  • Formview doesn't change Mode

    - by Vinzcent
    When I try to change my formview to Edit, he stays in de ReadOnlyMode. I can't figure out why. This is my code. <asp:FormView ID="fvDetailOrder" runat="server" AllowPaging="True" DataKeyNames="ID" OnModeChanging="fvDetailOrder_ModeChanging"> <EditItemTemplate> // I want to see this, when I click edit <asp:LinkButton ForeColor="#003366" ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" /> &nbsp;<asp:LinkButton ForeColor="#003366" ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </EditItemTemplate> <InsertItemTemplate> Insert here <asp:LinkButton ForeColor="#003366" ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" /> &nbsp;<asp:LinkButton ForeColor="#003366" ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </InsertItemTemplate> <ItemTemplate> Read only <asp:LinkButton ForeColor="#003366" ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" /> &nbsp;<asp:LinkButton ForeColor="#003366" ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you certain you want to delete this product?');" /> &nbsp;<asp:LinkButton ForeColor="#003366" ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New" /> </ItemTemplate> <PagerStyle ForeColor="#003366" /> </asp:FormView> Eventhandler protected void fvDetailOrder_ModeChanging(Object sender, FormViewModeEventArgs e) { fvDetailOrder.ChangeMode(e.NewMode); }

    Read the article

  • Creating an AJAX Accordion Menu

    - by jaullo
    Introduction Ajax is a powerful addition to asp.net that provides new functionality in a simple and agile  way This post is dedicated to creating a menu with ajax accordion type. About the Control The basic idea of this control, is to provide a serie of panels and show and hide information inside these panels. The use is very simple, we have to set each panel inside accordion control and give to each panel a Header and of course, we have to set the content of each panel.  To use accordion control, u need the ajax control toolkit. know the basic propertyes of accordion control:  Before start developing an accordion control, we have to know the basic properties for this control Other accordion propertyes  FramesPerSecond - Number of frames per second used in the transition animations RequireOpenedPane - Prevent closing the currently opened pane when its header is clicked (which ensures one pane is always open). The default value is true. SuppressHeaderPostbacks - Prevent the client-side click handlers of elements inside a header from firing (this is especially useful when you want to include hyperlinks in your headers for accessibility) DataSource - The data source to use. DataBind() must be called. DataSourceID - The ID of the data source to use. DataMember - The member to bind to when using a DataSourceID  AJAX Accordion Control Extender DataSource  The Accordion Control extender of AJAX Control toolkit can also be used as DataBound control. You can bind the data retrieved from the database to the Accordion control. Accordion Control consists of properties such as DataSource and DataSourceID (we can se it above) that can be used to bind the data. HeaderTemplate can used to display the header or title for the pane generated by the Accordion control, a click on which will open or close the ContentTemplate generated by binding the data with Accordion extender. When DataSource is passed to the Accordion control, also use the DataBind method to bind the data. The Accordion control bound with data auto generates the expand/collapse panes along with their headers.  This code represents the basic steps to bind the Accordion to a Datasource Collapse Public Sub getCategories() Dim sqlConn As New SqlConnection(conString) sqlConn.Open() Dim sqlSelect As New SqlCommand("SELECT * FROM Categories", sqlConn) sqlSelect.CommandType = System.Data.CommandType.Text Dim sqlAdapter As New SqlDataAdapter(sqlSelect) Dim myDataset As New DataSet() sqlAdapter.Fill(myDataset) sqlConn.Close() Accordion1.DataSource = myDataset.Tables(0).DefaultView Accordion1.DataBind()End Sub Protected Sub Accordion1_ItemDataBound(sender As Object, _ e As AjaxControlToolkit.AccordionItemEventArgs) If e.ItemType = AjaxControlToolkit.AccordionItemType.Content Then Dim sqlConn As New SqlConnection(conString) sqlConn.Open() Dim sqlSelect As New SqlCommand("SELECT productName " & _ "FROM Products where categoryID = '" + _ DirectCast(e.AccordionItem.FindControl("txt_categoryID"),_ HiddenField).Value + "'", sqlConn) sqlSelect.CommandType = System.Data.CommandType.Text Dim sqlAdapter As New SqlDataAdapter(sqlSelect) Dim myDataset As New DataSet() sqlAdapter.Fill(myDataset) sqlConn.Close() Dim grd As New GridView() grd = DirectCast(e.AccordionItem.FindControl("GridView1"), GridView) grd.DataSource = myDataset grd.DataBind() End If End Sub In the above code, we made two things, first, we made a sql select to database to retrieve all data from categories table, this data will be used to set the header and columns of the accordion.  Collapse <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <ajaxToolkit:Accordion ID="Accordion1" runat="server" TransitionDuration="100" FramesPerSecond="200" FadeTransitions="true" RequireOpenedPane="false" OnItemDataBound="Accordion1_ItemDataBound" ContentCssClass="acc-content" HeaderCssClass="acc-header" HeaderSelectedCssClass="acc-selected"> <HeaderTemplate> <%#DataBinder.Eval(Container.DataItem,"categoryName") %> </HeaderTemplate> <ContentTemplate> <asp:HiddenField ID="txt_categoryID" runat="server" Value='<%#DataBinder.Eval(Container.DataItem,"categoryID") %>' /> <asp:GridView ID="GridView1" runat="server" RowStyle-BackColor="#ededed" RowStyle-HorizontalAlign="Left" AutoGenerateColumns="false" GridLines="None" CellPadding="2" CellSpacing="2" Width="300px"> <Columns> <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Product Name" HeaderStyle-BackColor="#d1d1d1" HeaderStyle-ForeColor="#777777"> <ItemTemplate> <%#DataBinder.Eval(Container.DataItem,"productName") %> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </ContentTemplate> </ajaxToolkit:Accordion>  Here, we use <%#DataBinder.Eval(Container.DataItem,"categoryName") %> to bind accordion header with categoryName, so we made on header for each element found on database.    Creating a basic accordion control As we know, to use any of the ajax components, there must be a registered ScriptManager on our site, which will be responsible for managing our controls. So the first thing we will do is create our script manager.     Collapse <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> Then we define our accordion  element and establish some basic properties:    Collapse <cc1:Accordion ID="AccordionCtrl" runat="server" SelectedIndex="0" HeaderCssClass="accordionHeader" ContentCssClass="accordionContent" AutoSize="None" FadeTransitions="true" TransitionDuration="250" FramesPerSecond="40" For our work we must declare PANES accordion inside it, these breads will be responsible for contain information, links or information that we want to show.  Collapse <Panes> <cc1:AccordionPane ID="AccordionPane0" runat="server"> <Header>Matenimiento</Header> <Content> <li><a href="mypagina.aspx">My página de prueba</a></li> </Content> </cc1:AccordionPane> To end this work, we have to close all panels and our accordion Collapse </Panes> </cc1:Accordion> Finally complete our example should look like:  Collapse <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <cc1:Accordion ID="AccordionCtrl" runat="server" SelectedIndex="0" HeaderCssClass="accordionHeader" ContentCssClass="accordionContent" AutoSize="None" FadeTransitions="true" TransitionDuration="250" FramesPerSecond="40"> <Panes> <cc1:AccordionPane ID="AccordionPane0" runat="server"> <Header>Matenimiento</Header> <Content> <li><a href="mypagina.aspx">My página de prueba</a></li> </Content> </cc1:AccordionPane> </Panes> </cc1:Accordion>

    Read the article

  • ASP.NET - Call required field validator before AJAX modalpopup, client side

    - by odinel
    I have an ASP.NET/C# application. The user fills out a form with required fields, then clicks a submit button. An AJAX popup message is then displayed, and if they confirm, their information is posted back to the server. The problem is that the AJAX popup is fired BEFORE the req validator. I need to interrupt this and run the req validator, and then if successful show the popup. I know the req validator is working, because if you cancel the popup message, the req text is shown next to the fields. Textbox and AJAX control code is here: <table> <tr> <td>Name</td> <td> <asp:TextBox ID="txtName" runat="server" CssClass="textBox" AutoPostBack="true"></asp:TextBox> <asp:RequiredFieldValidator ID="reqName" runat="server" Text="*" ControlToValidate="txtName" ValidationGroup="trade" ForeColor="White"></asp:RequiredFieldValidator> </td> </tr> <tr> <td>Address</td> <td> <asp:TextBox ID="txtAdd1" runat="server" CssClass="textBox"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Text="*" ControlToValidate="txtAdd1" ValidationGroup="trade" ForeColor="White"></asp:RequiredFieldValidator> </td> </tr> <tr> <td></td> <td> <asp:Button ID="btnSubmitEnquiry" runat="server" CssClass="buttonText" Text="Submit Enquiry" ValidationGroup="trade" /> </td> </tr> </table> <ajax:ModalPopupExtender ID="ModalPopupExtender1" runat="server" okcontrolid="lnkCancel" targetcontrolid="btnSubmitEnquiry" popupcontrolid="pnlConfirm" popupdraghandlecontrolid="PopupHeader" drag="true" ></ajax:ModalPopupExtender> <asp:Button Text="targetbutton" ID="btnConfTgt" runat="server" Style="display: none" /> <asp:Panel ID="pnlConfirm" style="display:none" runat="server"> <div class="PopupContainer"> <div class="PopupBody"> <br /> <div align="center"> <asp:label ID="Label1" runat="server" CssClass="lblConfirmpopup"> Message goes here </asp:label> </div> <br /><br /><br /> <div align="center"> <asp:LinkButton ID="lnkCancel" runat="server" visible="true" Text="Cancel" CommandName="Update" BorderColor="#FFFFFF" BackColor="#000000" BorderWidth="3" BorderStyle="Double" ForeColor="White" Font-Size="13pt" Font-Underline="False"></asp:LinkButton> <asp:LinkButton ID="lnkConfirm" runat="server" visible="true" Text="Submit Enquiry" CommandName="Update" BorderColor="#FFFFFF" BackColor="#000000" BorderWidth="3" BorderStyle="Double" ForeColor="White" Font-Size="13pt" Font-Underline="False" OnClick="btnSubmitEnquiry_Click"></asp:LinkButton> </div> </div> </div> </asp:Panel> I've tried coding the first submit button to call the client-side req validator method, but no joy; it still shows the popup before the req validator. If there's no simple solution, I was thinking of perhaps an 'outside the box' solution, maybe hiding the initial Submit button after the req validation has passed, then showing an additional button with the popup control attached to it. Not sure how I'd be able to achieve this though. Thanks

    Read the article

  • datalist edit mode.

    - by Ranjana
    i have a datalist control <ItemTemplate> <tr> <td height="31px"> <asp:Label ID="lblStudentName" runat="server" Text="StudentName :" Font-Bold="true"></asp:Label> <%# DataBinder.Eval(Container.DataItem, "StudentName") %> </td> <td height="31px"> <asp:LinkButton ID="lnkEdit" runat="server" CommandName="edit">Edit</asp:LinkButton> </td> </tr> <tr> <td> <asp:Label ID="lblAdmissionNo" runat="server" Text="AdmissionNo :" Font-Bold="true"></asp:Label> <%# DataBinder.Eval(Container.DataItem, "AdmissionNo")%> </td> </tr> <tr> <td height="31px"> <asp:Label ID="lblStudentRollNo" runat="server" Text="StdentRollNo :" Font-Bold="true"></asp:Label> <%# DataBinder.Eval(Container.DataItem, "StdentRollNo") %> </td> <td height="31px"> <asp:LinkButton ID="lnkEditroll" runat="server" CommandName="edit">Edit</asp:LinkButton> </td> </tr> </ItemTemplate> <EditItemTemplate> <tr> <td height="31px"> <asp:Label ID="lblStudentName" runat="server" Text="StudentName :" Font-Bold="true"></asp:Label> <asp:TextBox ID="txtProductName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "StudentName") %>'></asp:TextBox> </td> <td> <asp:LinkButton ID="lnkUpdate" runat="server" CommandName="update">Update</asp:LinkButton> <asp:LinkButton ID="lnkCancel" runat="server" CommandName="cancel">Cancel</asp:LinkButton> </td> </tr> <tr> <td height="31px"> <asp:Label ID="lblAdmissionNo" runat="server" Text="AdmissionNo :" Font-Bold="true"></asp:Label> <%# DataBinder.Eval(Container.DataItem, "AdmissionNo")%> </td> </tr> <tr> <td height="31px"> <asp:Label ID="lblStudentRollNo" runat="server" Text="StudentRollNo :" Font-Bold="true"></asp:Label> <asp:TextBox ID="txtStudentRollNo" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "StdentRollNo") %>'></asp:TextBox> </td> <td> <asp:LinkButton ID="LinkButton1" runat="server" CommandName="update">Update</asp:LinkButton> <asp:LinkButton ID="LinkButton2" runat="server" CommandName="cancel">Cancel</asp:LinkButton> </td> </tr> </EditItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:DataList> code behind: protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DataTable dt = new DataTable(); dt = obj.GetSamples(); DataList1.DataSource = dt; DataList1.DataBind(); } } public void DataBind() { DataTable dt = new DataTable(); dt = obj.GetSamples(); DataList1.DataSource = dt; DataList1.DataBind(); } protected void DataList1_EditCommand1(object source, DataListCommandEventArgs e) { DataList1.EditItemIndex = e.Item.ItemIndex; DataBind(); } protected void DataList1_CancelCommand1(object source, DataListCommandEventArgs e) { DataList1.EditItemIndex = -1; DataBind(); } protected void DataList1_UpdateCommand1(object source, DataListCommandEventArgs e) { // Get the DataKey value associated with current Item Index. // int AdmissionNo = Convert.ToInt32(DataList1.DataKeys[e.Item.ItemIndex]); string AdmissionNo = DataList1.DataKeys[e.Item.ItemIndex].ToString(); // Get updated value entered by user in textbox control for // ProductName field. TextBox txtProductName; txtProductName = (TextBox)e.Item.FindControl("txtProductName"); TextBox txtStudentRollNo; txtStudentRollNo = (TextBox)e.Item.FindControl("txtStudentRollNo"); // string variable to store the connection string // retrieved from the connectionStrings section of web.config string connectionString = ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString; // sql connection object SqlConnection mySqlConnection = new SqlConnection(connectionString); // sql command object initialized with update command text SqlCommand mySqlCommand = new SqlCommand("update SchoolAdmissionForm set StudentName=@studentname ,StdentRollNo=@studentroll where AdmissionNo=@admissionno", mySqlConnection); mySqlCommand.Parameters.Add("@studentname", SqlDbType.VarChar).Value = txtProductName.Text; mySqlCommand.Parameters.Add("@admissionno", SqlDbType.VarChar).Value = AdmissionNo; mySqlCommand.Parameters.Add("@studentroll", SqlDbType.VarChar).Value = txtStudentRollNo.Text; // check the connection state and open it accordingly. if (mySqlConnection.State == ConnectionState.Closed) mySqlConnection.Open(); // execute sql update query mySqlCommand.ExecuteNonQuery(); // check the connection state and close it accordingly. if (mySqlConnection.State == ConnectionState.Open) mySqlConnection.Close(); // reset the DataList mode back to its initial state DataList1.EditItemIndex = -1; DataBind(); // BindDataList(); } But it works fine.... but when i click edit command both the Fields 1.StudentName 2.StudentRollNo im getting textboxes to all the fields where i placed textbox when i click 'edit' command and not the particular field alone . but i should get oly the textbox visible to the field to which i clik as 'edit' , and the rest remain same without showing textboxes even though it is in editmode

    Read the article

  • ASP.NET how to save textbox in database?

    - by mahsoon
    I used some textboxes to get some info from users + a sqldatasource <tr> <td class="style3" colspan="3" style="font-size: medium; font-family: 'B Nazanin'; font-weight: bold; position: relative; right: 170px" > &nbsp; ????? ??????? ????</td> </tr> <tr> <td class="style3"> &nbsp;&nbsp;&nbsp; <asp:Label ID="Label1" runat="server" Text=" ???: " Font-Bold="True" Font-Names="B Nazanin" Font-Size="Medium"></asp:Label> </td> <td class="style2"> <asp:TextBox ID="FirstName" runat="server"></asp:TextBox> </td> <td class="style4"> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic" ErrorMessage="???? ???? ??? ?????? ???" ControlToValidate="FirstName">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td class="style3"> &nbsp;&nbsp;&nbsp;<asp:Label ID="Label2" runat="server" Text=" ??? ????????: " Font-Bold="True" Font-Names="B Nazanin" Font-Size="Medium"></asp:Label> </td> <td class="style2"> <asp:TextBox ID="LastName" runat="server"></asp:TextBox> </td> <td class="style4"> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic" ErrorMessage="???? ???? ??? ???????? ?????? ???" ControlToValidate="LastName">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td class="style3"> &nbsp;&nbsp;&nbsp;<asp:Label ID="Label3" runat="server" Text=" ????? ???????? : " Font-Bold="True" Font-Names="B Nazanin" Font-Size="Medium"></asp:Label> </td> <td class="style2"> <asp:TextBox ID="StudentNumber" runat="server"></asp:TextBox> </td> <td class="style4"> <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" Display="Dynamic" ErrorMessage="???? ???? ????? ???????? ?????? ???" ControlToValidate="StudentNumber">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td class="style3"> &nbsp;&nbsp;<asp:Label ID="Label4" runat="server" Text="  ????? ???? : " Font-Bold="True" Font-Names="B Nazanin" Font-Size="Medium"></asp:Label> </td> <td class="style2"> <asp:TextBox ID="DateOfBirth" runat="server"></asp:TextBox> </td> <td class="style4"> <asp:CompareValidator ID="CompareValidator1" runat="server" Display="Dynamic" ErrorMessage="????? ???? ?????? ?? ???? ??????" Operator="DataTypeCheck" Type="Date" ControlToValidate="dateOfBirth"></asp:CompareValidator> </td> </tr> <tr> <td class="style3"> &nbsp;</td> <td class="style2"> <asp:Button ID="SaveButton" runat="server" Text=" ????? ???????" Width="102px" style="margin-right: 15px; height: 26px;" /> </td> <td class="style4"> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString1 %>" SelectCommand="SELECT aspnet_personalInformation.FirstName, aspnet_personalInformation.LastName, aspnet_personalInformation.StudentNumber, aspnet_personalInformation.DateOfBirth FROM aspnet_personalInformation INNER JOIN aspnet_Users ON aspnet_personalInformation.UserId = aspnet_Users.UserId WHERE aspnet_personalInformation.UserId=aspnet_Users.UserId ORDER BY aspnet_personalInformation.LastName" InsertCommand="INSERT INTO aspnet_PersonalInformation(UserId) SELECT UserId FROM aspnet_Profile"> </asp:SqlDataSource> </td> </tr> </table> i wanna save firstname lastname studentnumber and dateofbirth in aspnet_personalinformation table in database but before that, i fill one column of aspnet_personalinformation table named UserId by inserting sql command with aspnet_profile.userid now by running this code my table has still blankes protected void SaveButton_Click(object sender, EventArgs e) { string str= "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\ASPNETDB.MDF;Integrated Security=True;User Instance=True"; SqlConnection con = new SqlConnection(str); con.Open(); string query = "INSERT INTO aspnet_PersonalInformation( FirstName, LastName,StudentNumber,DateOfBirth) VALUES ('" + this.FirstName.Text + "','" + this.LastName.Text + "','" + this.StudentNumber.Text + "','" + this.DateOfBirth.Text + "') where aspnet_PersonalInformation.UserId=aspnet_Profile.UserID"; SqlCommand cmd=new SqlCommand(query,con); cmd.ExecuteNonQuery(); con.Close(); } but it doesn't work help me plz

    Read the article

  • ListView not firing OnItemCommand after preventing postback

    - by nevizi
    Hi there, I have a ListView inside a FormView that, for some strange reason, doesn't fire neither the ItemInsert nor the ItemCommand event. I'm populating the ListView with a generic list. I bind the list to the ListView on the OnPreRenderComplete. <asp:ListView runat="server" ID="lvReferences" DataKeyNames="idReference" OnItemInserting="ContractReferences_Inserting" OnItemDeleting="ContractReferences_Deleting" InsertItemPosition="LastItem" OnItemCommand="ContractReferences_Command" OnItemCreated="ContractReferences_ItemDataBound"> <LayoutTemplate> <ul> <asp:PlaceHolder ID="itemPlaceholder" runat="server" /> </ul> </LayoutTemplate> <ItemTemplate> <li class="obsItem"> <a href="#"><asp:TextBox ID="valRef" runat="server" Width="5px" Enabled="false" Text='<%#Bind("idProcessRecordRef") %>' /></a> <asp:TextBox id="txtRef" runat="server" Text='<%#Bind("description") %>' /> <asp:ImageButton ID="btDelete" runat="server" CommandName="Delete" ImageUrl="~/_layouts/web.commons/Images/eliminar.png" /> </li> </ItemTemplate> <InsertItemTemplate> <li class="obsItem"> <a href="#"><asp:TextBox ID="valRef" runat="server" Width="5px" Enabled="false" /></a> <asp:TextBox id="txtRef" runat="server" /> <asp:ImageButton ID="btDetail" CausesValidation="false" OnClientClick="javascript:openPopup();return false;" runat="server" ImageUrl="~/_layouts/web.commons/Images/novo.png" /> <asp:ImageButton ID="btSaveDs" runat="server" CommmandName="Insert" CausesValidation="false" ImageUrl="~/_layouts/web.commons/Images/gravarObs.png" /> </li> </InsertItemTemplate> </asp:ListView> My ItemDataBound method is: protected void ContractReferences_ItemDataBound(object sender, ListViewItemEventArgs e) { if (!IsPostBack) { TextBox valRef = e.Item.FindControl("valRef") as TextBox; TextBox txtRef = e.Item.FindControl("txtRef") as TextBox; ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "function openPopup(){ window.open('ContractPicker.aspx?c1=" + valRef.ClientID + "&c2=" + txtRef.ClientID + "');}", true); } } So, basically, in the InsertItemTemplate I put a button that opens a LOV and populates my valRef and txtRef fields. I had to put a "return false" in order for the parent page to not postback (and I think the problem lies here...). Then, when I click in the ImageButton with the CommandName="Insert", instead of firing the ItemCommand event, it enters once again in the ItemDataBound handler. So, any ideas? Thanks!

    Read the article

  • Jquery .ajax async postback on C# UserControl

    - by tnriverfish
    I'm working on adding a todo list to a project system and would like to have the todo creation trigger a async postback to update the database. I'd really like to host this in a usercontrol so I can drop the todo list onto a project page, task page or stand alone todo list page. Here's what I have. User Control "TodoList.ascx" which lives in the Controls directory. The script that sits at the top of the UserControl. You can see where I started building jsonText to postback but when that didn't work I just tried posting back an empty data variable and removed the 'string[] items' variable from the AddTodo2 method. <script type="text/javascript"> $(document).ready(function() { // Add the page method call as an onclick handler for the div. $("#divAddButton").click(function() { var jsonText = JSON.stringify({ tdlId: 1, description: "test test test" }); //data: jsonText, $.ajax({ type: "POST", url: "TodoList.aspx/AddTodo2", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { alert('retrieved'); $("#divAddButton").text(msg.d); }, error: function() { alert("error"); } }); }); });</script> The rest of the code on the ascx. <div class="divTodoList"> <asp:PlaceHolder ID="phTodoListCreate" runat="server"> <div class="divTLDetail"> <div>Description</div> <div><asp:TextBox ID="txtDescription" runat="server"></asp:TextBox></div> <div>Active</div> <div><asp:CheckBox ID="cbActive" runat="server" /></div> <div>Access Level</div> <div><asp:DropDownList ID="ddlAccessLevel" runat="server"></asp:DropDownList></div> </div> </asp:PlaceHolder> <asp:PlaceHolder ID="phTodoListDisplayHeader" runat="server"> <div id="divTLHeader"> <asp:HyperLink ID="hlHeader" runat="server"></asp:HyperLink> </div> </asp:PlaceHolder> <asp:PlaceHolder ID="phTodoListItems" runat="server"> <div class="divTLItems> <asp:Literal ID="litItems" runat="server"></asp:Literal> </div> </asp:PlaceHolder> <asp:PlaceHolder ID="phAddTodo" runat="server"> <div class="divTLAddItem"> <div id="divAddButton">Add Todo</div> <div id="divAddText"><asp:TextBox ID="txtNewTodo" runat="server"></asp:TextBox></div> </div> </asp:PlaceHolder> <asp:Label ID="lbTodoListId" runat="server" style="display:none;"></asp:Label></div> To test the idea I created a /TodoList.aspx page that lives in the root directory. <uc1:TodoList runat="server" ID="tdl1" TodoListId="1" ></uc1:TodoList> The cs for the todolist.aspx protected void Page_Load(object sender, EventArgs e) { SecurityManager sm = new SecurityManager(); sm.MemberLevelAccessCheck(MemberLevelKey.AreaAdmin); } public static string AddTodo2() { return "yea!"; } My hope is that I can have a control that can be used to display multiple todo lists and create a brand new todo list as well. When I click on the #divAddButton I can watch it build the postback in firebug but once it completes it runs the error portion by alerting 'error'. I can't see why. I'd really rather have the response method live inside the user control as well. Since I'll be dropping it on several pages to keep from having to go put a method on each individual page. Any help would be appreciated.

    Read the article

  • Looking for a workaround for IE 6/7 "Unspecified Error" bug when accessing offsetParent; using ASP.N

    - by CodeChef
    I'm using jQuery UI's draggable and droppable libraries in a simple ASP.NET proof of concept application. This page uses the ASP.NET AJAX UpdatePanel to do partial page updates. The page allows a user to drop an item into a trashcan div, which will invoke a postback that deletes a record from the database, then rebinds the list (and other controls) that the item was drug from. All of these elements (the draggable items and the trashcan div) are inside an ASP.NET UpdatePanel. Here is the dragging and dropping initialization script: function initDragging() { $(".person").draggable({helper:'clone'}); $("#trashcan").droppable({ accept: '.person', tolerance: 'pointer', hoverClass: 'trashcan-hover', activeClass: 'trashcan-active', drop: onTrashCanned }); } $(document).ready(function(){ initDragging(); var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_endRequest(function() { initDragging(); }); }); function onTrashCanned(e,ui) { var id = $('input[id$=hidID]', ui.draggable).val(); if (id != undefined) { $('#hidTrashcanID').val(id); __doPostBack('btnTrashcan',''); } } When the page posts back, partially updating the UpdatePanel's content, I rebind the draggables and droppables. When I then grab a draggable with my cursor, I get an "htmlfile: Unspecified error." exception. I can resolve this problem in the jQuery library by replacing elem.offsetParent with calls to this function that I wrote: function IESafeOffsetParent(elem) { try { return elem.offsetParent; } catch(e) { return document.body; } } I also have to avoid calls to elem.getBoundingClientRect() as it throws the same error. For those interested, I only had to make these changes in the jQuery.fn.offset function in the Dimensions Plugin. My questions are: Although this works, are there better ways (cleaner; better performance; without having to modify the jQuery library) to solve this problem? If not, what's the best way to manage keeping my changes in sync when I update the jQuery libraries in the future? For, example can I extend the library somewhere other than just inline in the files that I download from the jQuery website. Update: @some It's not publicly accessible, but I will see if SO will let me post the relevant code into this answer. Just create an ASP.NET Web Application (name it DragAndDrop) and create these files. Don't forget to set Complex.aspx as your start page. You'll also need to download the jQuery UI drag and drop plug in as well as jQuery core Complex.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Complex.aspx.cs" Inherits="DragAndDrop.Complex" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> <script src="jquery-1.2.6.min.js" type="text/javascript"></script> <script src="jquery-ui-personalized-1.5.3.min.js" type="text/javascript"></script> <script type="text/javascript"> function initDragging() { $(".person").draggable({helper:'clone'}); $("#trashcan").droppable({ accept: '.person', tolerance: 'pointer', hoverClass: 'trashcan-hover', activeClass: 'trashcan-active', drop: onTrashCanned }); } $(document).ready(function(){ initDragging(); var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_endRequest(function() { initDragging(); }); }); function onTrashCanned(e,ui) { var id = $('input[id$=hidID]', ui.draggable).val(); if (id != undefined) { $('#hidTrashcanID').val(id); __doPostBack('btnTrashcan',''); } } </script> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div> <asp:UpdatePanel ID="updContent" runat="server" UpdateMode="Always"> <ContentTemplate> <asp:LinkButton ID="btnTrashcan" Text="trashcan" runat="server" CommandName="trashcan" onclick="btnTrashcan_Click" style="display:none;"></asp:LinkButton> <input type="hidden" id="hidTrashcanID" runat="server" /> <asp:Button ID="Button1" runat="server" Text="Save" onclick="Button1_Click" /> <table> <tr> <td style="width: 300px;"> <asp:DataList ID="lstAllPeople" runat="server" DataSourceID="odsAllPeople" DataKeyField="ID"> <ItemTemplate> <div class="person"> <asp:HiddenField ID="hidID" runat="server" Value='<%# Eval("ID") %>' /> Name: <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' /> <br /> <br /> </div> </ItemTemplate> </asp:DataList> <asp:ObjectDataSource ID="odsAllPeople" runat="server" SelectMethod="SelectAllPeople" TypeName="DragAndDrop.Complex+DataAccess" onselecting="odsAllPeople_Selecting"> <SelectParameters> <asp:Parameter Name="filter" Type="Object" /> </SelectParameters> </asp:ObjectDataSource> </td> <td style="width: 300px;vertical-align:top;"> <div id="trashcan"> drop here to delete </div> <asp:DataList ID="lstPeopleToDelete" runat="server" DataSourceID="odsPeopleToDelete"> <ItemTemplate> ID: <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' /> <br /> Name: <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' /> <br /> <br /> </ItemTemplate> </asp:DataList> <asp:ObjectDataSource ID="odsPeopleToDelete" runat="server" onselecting="odsPeopleToDelete_Selecting" SelectMethod="GetDeleteList" TypeName="DragAndDrop.Complex+DataAccess"> <SelectParameters> <asp:Parameter Name="list" Type="Object" /> </SelectParameters> </asp:ObjectDataSource> </td> </tr> </table> </ContentTemplate> </asp:UpdatePanel> </div> </form> </body> </html> Complex.aspx.cs namespace DragAndDrop { public partial class Complex : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected List<int> DeleteList { get { if (ViewState["dl"] == null) { List<int> dl = new List<int>(); ViewState["dl"] = dl; return dl; } else { return (List<int>)ViewState["dl"]; } } } public class DataAccess { public IEnumerable<Person> SelectAllPeople(IEnumerable<int> filter) { return Database.SelectAll().Where(p => !filter.Contains(p.ID)); } public IEnumerable<Person> GetDeleteList(IEnumerable<int> list) { return Database.SelectAll().Where(p => list.Contains(p.ID)); } } protected void odsAllPeople_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["filter"] = this.DeleteList; } protected void odsPeopleToDelete_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["list"] = this.DeleteList; } protected void Button1_Click(object sender, EventArgs e) { foreach (int id in DeleteList) { Database.DeletePerson(id); } DeleteList.Clear(); lstAllPeople.DataBind(); lstPeopleToDelete.DataBind(); } protected void btnTrashcan_Click(object sender, EventArgs e) { int id = int.Parse(hidTrashcanID.Value); DeleteList.Add(id); lstAllPeople.DataBind(); lstPeopleToDelete.DataBind(); } } } Database.cs namespace DragAndDrop { public static class Database { private static Dictionary<int, Person> _people = new Dictionary<int,Person>(); static Database() { Person[] people = new Person[] { new Person("Chad") , new Person("Carrie") , new Person("Richard") , new Person("Ron") }; foreach (Person p in people) { _people.Add(p.ID, p); } } public static IEnumerable<Person> SelectAll() { return _people.Values; } public static void DeletePerson(int id) { if (_people.ContainsKey(id)) { _people.Remove(id); } } public static Person CreatePerson(string name) { Person p = new Person(name); _people.Add(p.ID, p); return p; } } public class Person { private static int _curID = 1; public int ID { get; set; } public string Name { get; set; } public Person() { ID = _curID++; } public Person(string name) : this() { Name = name; } } }

    Read the article

  • javascript problem on tab control

    - by mahfuz
    my tab control have four itmes. Each tab item are individual usercontrol and they have javascript method.*But always tab item1 index=0 works well*,rest of item javascript don't work.But individually they work well ,problem arise when i put them in tab control.*when i click rest of tab items javascript function Tab item1 index=0 ascx* page always load . server side event C# code works well for all tab items.....How to solve this problem .....What's the problem is? i use devespress tool ..... <table> <tr> <td> <dxtc:ASPxPageControl Width="500px" ID="ASPxPageControl1" runat="server" ActiveTabIndex="0" EnableCallbackCompression="True" EnableHierarchyRecreation="True" AutoPostBack="True"> <TabPages> <dxtc:TabPage Text="Charge Company"> <ContentCollection> <dxw:ContentControl ID="ContentControl1" runat="server"> <uc1:UCConfig_Charge_Company_Wise ID="UCConfig_Charge_Company_Wise" runat="server" /> </dxw:ContentControl> </ContentCollection> </dxtc:TabPage> <dxtc:TabPage Text="Charge Depository Company"> <ContentCollection> <dxw:ContentControl ID="ContentControl3" runat="server"> <uc2:UCConfig_Charge_Depository_Company_Wise ID="UCConfig_Charge_Depository_Company_Wise" runat="server" /> </dxw:ContentControl> </ContentCollection> </dxtc:TabPage> <dxtc:TabPage Text="Investor Charge "> <ContentCollection> <dxw:ContentControl ID="ContentControl5" runat="server"> <uc4:UCConfig_Investor_Account_Wise_Charge ID="UCConfig_Investor_Account_Wise_Charge" runat="server" /> </dxw:ContentControl> </ContentCollection> </dxtc:TabPage> <dxtc:TabPage Text="Charge Operation Mode "> <ContentCollection> <dxw:ContentControl ID="ContentControl4" runat="server"> <uc3:UCconfig_charge_operation_mode ID="UCconfig_charge_operation_mode" runat="server" /> </dxw:ContentControl> </ContentCollection> </dxtc:TabPage> </TabPages> </dxtc:ASPxPageControl> </td> </tr> </table> my first tab control item works well.but rest of them create problem.i need to call javascript all of them but calling javascript from others create problem ,they show me bellow error Microsoft JScript runtime error: 'this.GetStateInput().value' is null or not an object

    Read the article

  • ListView not firing OnItemCommand (nor ItemInserting) after preventing postback

    - by nevizi
    Hi there, I have a ListView inside a FormView that, for some strange reason, doesn't fire neither the ItemInsert nor the ItemCommand event. I'm populating the ListView with a generic list. I bind the list to the ListView on the OnPreRenderComplete. <asp:ListView runat="server" ID="lvReferences" DataKeyNames="idReference" OnItemInserting="ContractReferences_Inserting" OnItemDeleting="ContractReferences_Deleting" InsertItemPosition="LastItem" OnItemCommand="ContractReferences_Command" OnItemCreated="ContractReferences_ItemDataBound"> <LayoutTemplate> <ul> <asp:PlaceHolder ID="itemPlaceholder" runat="server" /> </ul> </LayoutTemplate> <ItemTemplate> <li class="obsItem"> <a href="#"><asp:TextBox ID="valRef" runat="server" Width="5px" Enabled="false" Text='<%#Bind("idProcessRecordRef") %>' /></a> <asp:TextBox id="txtRef" runat="server" Text='<%#Bind("description") %>' /> <asp:ImageButton ID="btDelete" runat="server" CommandName="Delete" ImageUrl="~/_layouts/web.commons/Images/eliminar.png" /> </li> </ItemTemplate> <InsertItemTemplate> <li class="obsItem"> <a href="#"><asp:TextBox ID="valRef" runat="server" Width="5px" Enabled="false" /></a> <asp:TextBox id="txtRef" runat="server" /> <asp:ImageButton ID="btDetail" CausesValidation="false" OnClientClick="javascript:openPopup();return false;" runat="server" ImageUrl="~/_layouts/web.commons/Images/novo.png" /> <asp:ImageButton ID="btSaveDs" runat="server" CommmandName="Insert" CausesValidation="false" ImageUrl="~/_layouts/web.commons/Images/gravarObs.png" /> </li> </InsertItemTemplate> </asp:ListView> My ItemDataBound method is: protected void ContractReferences_ItemDataBound(object sender, ListViewItemEventArgs e) { if (!IsPostBack) { TextBox valRef = e.Item.FindControl("valRef") as TextBox; TextBox txtRef = e.Item.FindControl("txtRef") as TextBox; ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "function openPopup(){ window.open('ContractPicker.aspx?c1=" + valRef.ClientID + "&c2=" + txtRef.ClientID + "');}", true); } } So, basically, in the InsertItemTemplate I put a button that opens a LOV and populates my valRef and txtRef fields. I had to put a "return false" in order for the parent page to not postback (and I think the problem lies here...). Then, when I click in the ImageButton with the CommandName="Insert", instead of firing the ItemCommand event, it enters once again in the ItemDataBound handler. So, any ideas? Thanks!

    Read the article

  • Asp.Net Login control (Visual Web Dev)

    - by craig
    This is the code when you take the Login control from the toolbox. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Login ID="Login1" runat="server" onauthenticate="Login1_Authenticate" BackColor="#F7F7DE" BorderColor="#CCCC99" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="10pt"> <LayoutTemplate> <table border="0" cellpadding="1" cellspacing="0" style="border-collapse:collapse;"> <tr> <td> <table border="0" 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 colspan="2"> <asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." /> </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" onclick="LoginButton_Click" /> </td> </tr> </table> </td> </tr> </table> </LayoutTemplate> <TitleTextStyle BackColor="#6B696B" Font-Bold="True" ForeColor="#FFFFFF" /> </asp:Login> </div> </form> </body> </html> Part of my aspx.cs protected void LoginButton_Click(object sender, EventArgs e) { String sUserName = UserName.Text; String sPassword = Password.Text; Error 1 The name 'UserName' does not exist in the current context Error 2 The name 'Password' does not exist in the current context Error 3 'ASP.default_aspx' does not contain a definition for 'Login1_Authenticate' and no extension method 'Login1_Authenticate' accepting a first argument of type 'ASP.default_aspx' could be found (are you missing a using directive or an assembly reference?) What am I doing wrong?

    Read the article

  • Embedded Javascript in Master Page or Pages That Use Master Page throw "Object Expected Error"

    - by Philter
    I'm semi-new to writing ASP.Net applications using master pages and I've run into an issue I've spent some time on but can't seem to solve. My situation is that I have a master page with a structure that looks like this: <head runat="server"> <title>Test Site</title> <link rel="Stylesheet" type="text/css" href="Default.css" /> <script type="text/javascript" language="javascript" src="js/Default.js" /> <meta http-equiv="Expires" content="0"/> <meta http-equiv="Cache-Control" content="no-cache"/> <meta http-equiv="Pragma" content="no-cache"/> <asp:ContentPlaceHolder ID="cphHead" runat="server"> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <div id="divHeader"> <asp:ContentPlaceHolder ID="cphPageTitle" runat="server"></asp:ContentPlaceHolder> </div> <div id="divMainContent"> <asp:ContentPlaceHolder ID="cphMainContent" runat="server"></asp:ContentPlaceHolder> </div> </div> </form> </body> I then have a page that uses this master page that contains the following: <asp:Content ContentPlaceHolderID="cphHead" runat="server"> <script type="text/javascript" language="javascript" > function test() { alert("Hello World"); } </script> </asp:Content> <asp:Content ContentPlaceHolderID="cphMainContent" runat="server"> <fieldset> <img alt="Select As Of Date" src="Images/Calendar.png" id="aAsOfDate" class="clickable" runat="server" onclick="test();" /> <asp:Button runat="server" CssClass="buttonStyle" ID="btnSubmit" Text="Submit" OnClick="btnSubmit_Clicked"/> </fieldset> </asp:Content> When I run this page and click on the image I get an "Object Expected" error. However, if I place the test function into my Default.js external file it will function perfectly. I can't seem to figure out why this is happening. Any ideas?

    Read the article

  • return a line of grid view in ModalPopupExtender

    - by Meysam Javadi
    hi i use ModalPopupExtender from AjaxControlToolkit to show a panel. my panel have something like this: <asp:Panel ID="pnlSearchPlan" runat="server" style="background-color:#ffffdd;border-width:3px;border-style:solid;border-color:Gray;padding:3px;width:400px;"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <cc1:ModalPopupExtender ID="UpdatePanel1_ModalPopupExtender" runat="server" TargetControlID="linkToPopup" PopupControlID="pnlSearchPlan" BackgroundCssClass="ModalBackColor" DropShadow="true" OkControlID="tbnSelect" OnOkScript="onOk()" CancelControlID="btnCancel"> </cc1:ModalPopupExtender> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <table width="100%" dir="rtl"> <tr> <td >owner</td> <td> <asp:TextBox ID="txtCriteria" runat="server" ></asp:TextBox> <asp:Button ID="btnOk" runat="server" Text="ok" onclick="btnOk_Click" /> <asp:Button ID="tbnSelect" runat="server" Text="select" onclick="tbnSelect_Click" /> <asp:Button ID="btnCancel" runat="server" Text="close" /> </td> </tr> <tr> <td colspan="2"> </asp:RadioButtonList> </td> </tr> <tr> <td colspan="2" align="center"> <pcal:CustomGridView ID="gdvPlan" runat="server" CellPadding="4" ForeColor="Black" GridLines="Vertical" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"> <RowStyle BackColor="#F7F7DE" /> <FooterStyle BackColor="#CCCC99" /> <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" /> <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> </pcal:CustomGridView> </td> </tr> </table> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> now want return one cell of gridview after ModalPopupExtender is closed, is this possible without postback? is there any way to return value after close?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >