Asp.net Ajax textbox calendar extender updating but only on screen - asp.net

The code is the one below. I've tried several solution from other posts but none worked. This should be a very simple task tough. After clicking on the image, the calendar appears, the textbox is updated but when I get the .text property it still is unchanged.
Thanx for any help
<%# Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" Inherits="Comunicazioni_ClassificaInterna" Title="Classifica interna" Codebehind="ClassificaInterna.aspx.cs" %>
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="True" EnableScriptLocalization="False"> </asp:ScriptManager>
<br />
<asp:TextBox ID="tbCompetitionDate" runat="server" ReadOnly="True"></asp:TextBox>
<cc1:CalendarExtender ID="tbCompetitionDate_CalendarExtender" runat="server" PopupButtonID="imgPopup" Format="dd/MM/yyyy" BehaviorID="tbCompetitionDate_CalendarExtender" TargetControlID="tbCompetitionDate" FirstDayOfWeek="Monday" />
<asp:ImageButton ID="imgPopup" ImageUrl="../../../Resources/Pics/calendar.png" ImageAlign="Bottom" runat="server" Height="25px" Width="30px" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="FooterPlaceHolder" runat="server">
<img alt="" src="../../Resources/Pics/Footer.png" style="margin-left:500px; margin-top:200px; width:300px;height:50px" />
</asp:Content>

Related

UpdatePanel always post back whole page

There is an UpdatePanel add inside UserControl, and this user control is added inside the MasterPage. When clicking on a button in that UpdatePanl. The whole page is refreshed. why?
Master Page:
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="webasite.SiteMaster" %>
<%# Register Src="views/uc/_aside.ascx" TagPrefix="uc1" TagName="_aside" %>
<%# Register Src="views/uc/_page-loader.ascx" TagPrefix="uc1" TagName="_pageloader" %>
<!DOCTYPE html>
<html lang="ar" direction="rtl" dir="rtl" style="direction: rtl">
<!--begin::Head-->
<head>
<base href="">
<meta charset="utf-8" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"></asp:ScriptManager>
<uc1:_pageloader runat="server" id="_pageloader" />
<uc1:_aside runat="server" id="_aside" />
</form>
</body>
</html>
User control: _aside.ascx
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="_aside.ascx.cs" Inherits="cidyai.partials.uc._aside" %>
<%# Register Src="~/app/views/uc/dashboard.ascx" TagPrefix="uc2" TagName="dashboard" %>
<%# Register Src="~/app/views/uc/drivers.ascx" TagPrefix="uc1" TagName="drivers" %>
<uc2:dashboard runat="server" ID="dashboard" UpdateMode="Conditional"/>
<uc1:drivers runat="server" id="drivers" UpdateMode="Conditional"/>
User control: drivers.ascx
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="drivers.ascx.cs" Inherits="cidyai.app.views.uc.drivers" %>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate></ProgressTemplate>
</asp:UpdateProgress>
<form class="form">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="txtFirstName" runat="server" CssClass="form-control form-control-solid" placeholder="Name"></asp:TextBox>
<asp:Button ID="btnSave" CssClass="btn btn-primary mr-2" runat="server" Text="save" OnClick="btnSave_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</form>

Masterpage blocking search bar

I have a page with a gridview that displays results from a query and has paging and a search bar. It works fine when I load it by itself with not master page however when I add the master page to it all the controls disappear. below is the code with the master page and without
<%# Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="Default3.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent"
Runat="Server">
<%# Import Namespace="GridView" %>
<div>
<div align="center" class="padded" >
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
Font-Size="Large" OnSelectedIndexChanged="Refresh_Click">
</asp:DropDownList>
<asp:Button ID="Refresh" runat="server" OnClick="Refresh_Click"
Text="Search" Visible="False" />
</div>
<div>
<cc1:HTMLGridView ID="HTMLGridView1" runat="server"
OnRowDataBound="OnRowDataBound2"/>
</div>
Here is the code that works with no master page
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs"
Inherits="_Default" %>
<%# Register assembly="GridView" namespace="GridView" tagprefix="cc1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div align="center" class="padded" >
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
Font-Size="Large" OnSelectedIndexChanged="Refresh_Click">
</asp:DropDownList>
<asp:Button ID="Refresh" runat="server" OnClick="Refresh_Click"
Text="Search" Visible="False" />
</div>
<cc1:HTMLGridView ID="HTMLGridView1" runat="server"
OnRowDataBound="OnRowDataBound2" allowDeleting="False" allowEditing="False"
allowView="False"/>
</form>
</body>
</html>
I also added the reference to the web.config file but I have had no luck
<add tagPrefix="cc1" namespace="GridView" assembly="GridView" />
Where am I going wrong?
Try adding
<%# Import Namespace="GridView" %>
before
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent"
Runat="Server">

Moving page from Updatepanel to AccordianPane 'hides' previously visible property

I'm trying to move a page from an AJAX UpdatePanel to an Ajax Control Toolkit AccordianPane. When I run the app I get the following error :
DataBinding: 'AjaxControlToolkit.AccordionContentPanel' does not
contain a property with the name 'IsNdmaVisible'.
Here is a code snippet from the page I'm embedding in the AccordianPaneControl, with the property IsNdmaVisible in question, as referred to in the DataBinder.Eval method:
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="ScenarioEditor.ascx.cs"
Inherits="Clients.Views.Controls.ScenarioEditor" %>
<%# Register Src="~/SharedUserControls/AjaxMonthCalendar.ascx" TagName="AjaxMonthCalendar" TagPrefix="ajaxMonthCalendar" %>
<%# Register Src="~/SharedUserControls/AjaxFcdMonthCalendar.ascx" TagName="AjaxFcdMonthCalendar" TagPrefix="ajaxMonthCalendar" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:UpdatePanel ID="m_ScenarioEditorUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="m_ScenarioEditorPanel" runat="server" meta:resourcekey="m_ScenarioEditorPanelResource1">
<table class="layout-table input-strech">
<tr>
<td colspan="4">
<table class="layout-table" >
<tr>
<td>
<asp:CheckBox ID="m_SnowBallCheckBox" ValidationGroup="ScenarioStrategies" runat="server"
Width="100px" meta:resourcekey="m_SnowBallCheckBox" />
</td>
<td>
<asp:CheckBox ID="m_NDMACheckBox" ValidationGroup="ScenarioStrategies" runat="server"
Width="100px" **Visible='<%# (bool)DataBinder.Eval(Container, "IsNdmaVisible") %>'**
Enabled='<%# (bool)DataBinder.Eval(Container, "IsNdmaEnabled") %>' meta:resourcekey="m_NDMACheckBox" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
</asp:Panel>
<div id="flag">
</div>
<asp:Literal ID="StartUpScript" runat="server" Visible="false">
<script language="javascript" type="text/javascript">
ScenarioEditor.StartUp();
</script>
</asp:Literal>
</ContentTemplate>
</asp:UpdatePanel>
Inasmuch embedding the above ScenarioEditor.ascx page, here with the original code snippet which works perfectly, followed by my new code, which obviously breaks (I'm including the assembly and code references only once for both snippets):
Reference and 'exteral' code registering:
<%# Page Title="" Language="C#" MasterPageFile="~/Shared/CareMaster.Master" AutoEventWireup="true" CodeBehind="EditScenario.aspx.cs" Inherits="Clients.Views.EditScenario" meta:resourcekey="PageResource1" %>
<%# Register Src="~/Clients/Controls/ScenarioEditor.ascx" TagName="ScenarioEditor" TagPrefix="clientControls" %>
<%# Register Src="~/SharedUserControls/CollapsibleContentPanel.ascx" TagName="CollapsibleContentPanel" TagPrefix="sharedControls" %>
<%# Register src="~/SharedUserControls/AjaxCalendar.ascx" tagname="AjaxCalendar" tagprefix="ajaxCalendar" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
Working Code:
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
<sharedControls:CollapsibleContentPanel ID="m_ScenarioEditorPanel" runat="server" style="margin-bottom: 1em">
<Title>
Scenario Details
</Title>
<Content>
<div >
<asp:HiddenField ID="labelForRadio" Value="" runat="server"/>
</div>
<asp:UpdatePanel ID="ButtonsPanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div style="float:left;">
<clientControls:ScenarioEditor runat="server" ID="m_ScenarioEditor" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</Content>
</sharedControls:CollapsibleContentPanel>
</asp:Content>
My code:
<ajaxToolkit:Accordion ID="Accordian1" runat="server">
<Panes>
<ajaxToolkit:AccordionPane ID="ScenarioDetails" runat="server">
<Header>Scenario Details</Header>
<Content>
<asp:UpdatePanel ID="ButtonsPanel" runat="server" BackColor="Yellow">
<ContentTemplate>
<div style="float:left;">
<clientControls:ScenarioEditor runat="server" ID="m_ScenarioEditor" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</Content>
</ajaxToolkit:AccordionPane>
</Panes>
</ajaxToolkit:Accordion>

UpdatePanel-hosted TextBox is not sent via button click (.NET 4.0 + AJAX Toolkit + VS 2013)

I've got a .NET 4.0 WebForms project with 2 UpdatePanels and textbox in one of them. When I enter text in "Group" textbox and then click on "Save ASYNC" button, the proper server function is called but nothing comes to txtGroup. I wonder what's wrong with my project and how to fix the issue. Below is my ASPX page:
<%# Page Title="Home Page" Language="C#" MasterPageFile="~/DEF.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderBodyAreaClass" runat="server">
<link href="Content/css/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="Content/CSS/AdminStyles.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<script type="text/javascript" src="Scripts/js/jquery-1.11.2.js"></script>
<script type="text/javascript" src="Scripts/js/jquery-ui.js"></script>
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<asp:UpdatePanel ID="UpdatePanel4" runat="server" >
<ContentTemplate>
<asp:Label ID="lblError" runat="server" ForeColor="Red" Text=""></asp:Label>
<asp:Button ClientIDMode="Static" ID="Button1" runat="server" Text="DIALOG"
OnClientClick="Dlg();return false;"
/>
</ContentTemplate>
</asp:UpdatePanel>
<div id="dialogQuests" class="dialogQuestsClass">
<div class="headerDivBlock">QUESTION</div>
<div class="contentDivBlock">
<asp:UpdatePanel ID="UpdatePanel6" runat="server" >
<ContentTemplate>
<table id="tableSizePositionQuest">
<tr>
<td>Group:</td>
<td>
<asp:TextBox ID="txtGroup" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="btnQuestSave" runat="server" UseSubmitBehavior="false" Text="Save ASYNC" OnClick="btnQuestSave_Click" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<script type="text/javascript">
function Dlg()
{
$('#dialogQuests').dialog({ minWidth: 840, resizable: true });
}
</script>
</asp:Content>

System.Web.UI.ScriptManager' does not have a public property named 'Button'

i try to show ssrsc reports in asp.net web page and for this i search tutorials and i find tutorials which shows me add script manager ,reportviewer and a button when i add these 3 things in my project in .aspx page and then when i debug my project then it shows me error
and here i clear that i can not add ajax tool kit reigster assembly in .aspx page for this how i add register assebly for ajax
code
<%# Register assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div align ="center" class="adminform">
<br /><br />
<center>
<div class="vpb_main_wrapper" align="center" style="left: inherit"/><br clear="all"/>
<asp:ScriptManager ID="ScriptManager1" runat="server">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<rsweb:ReportViewer ID="ReportViewer2" runat="server" Height="261px"
Width="476px">
</rsweb:ReportViewer>
</asp:ScriptManager>
</center>
</div>
</asp:Content>
Error
Type 'System.Web.UI.ScriptManager' does not have a public property named 'Button'.
Source Error:
Line 11: <asp:ScriptManager ID="ScriptManager1" runat="server">
Line 12:
Line 13: <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
Line 14:
Line 15: <rsweb:ReportViewer ID="ReportViewer2" runat="server" Height="261px"
The problem is you put Button1 and ReportViewer2 between <asp:ScriptManager ID="ScriptManager1" runat="server"> and </asp:ScriptManager>
<asp:ScriptManager ID="ScriptManager1" runat="server">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<rsweb:ReportViewer ID="ReportViewer2" runat="server" Height="261px"
Width="476px">
</rsweb:ReportViewer>
</asp:ScriptManager>
You need to move Button1 and ReportViewer2 out of ScriptManager1
<%# Register assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div align ="center" class="adminform">
<br /><br />
<center>
<div class="vpb_main_wrapper" align="center" style="left: inherit"/><br clear="all"/>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<rsweb:ReportViewer ID="ReportViewer2" runat="server" Height="261px"
Width="476px">
</rsweb:ReportViewer>
</center>
</div>
</asp:Content>

Resources