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

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>

Related

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>

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

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>

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>

Calender extender not working after removing and then adding ajax toolkit

The below code was working fine and i accidentally deleted ajax toolkit and when i reconfigured it its nit showing calender on clicking over text box.please tell me what to do with it .
moreover i request you to reply soon
<%# Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/emp.Master" CodeBehind="empleaveapp.aspx.vb" Inherits="abc.WebForm10" %>
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<head />.
<%--
<head id="Head2" runat="server" />.
--%>
<head />.
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Label ID="Label1" runat="server" Text="From"></asp:Label>
<asp:TextBox ID="calefrom" runat="server" CssClass="textbox" Height="16px"
Width="157px"></asp:TextBox>
<cc1:CalendarExtender ID="calefrom_CalendarExtender" runat="server"
Enabled="True" TargetControlID="calefrom" Format="yyyy-MM-dd">
</cc1:CalendarExtender>
<asp:CompareValidator ID="CompareValidator2" runat="server"
ControlToCompare="txttdate" ControlToValidate="calefrom" CssClass="active"
ErrorMessage="Please enter a day after today's date"
Operator="GreaterThan" > </asp:CompareValidator>
<br />
<asp:TextBox ID="txttdate" runat="server" Width="1px"></asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="To"></asp:Label>
<asp:TextBox ID="caleto" runat="server" Height="20px" CssClass="textbox"></asp:TextBox>
<cc1:CalendarExtender ID="caleto_CalendarExtender" runat="server"
Enabled="True" TargetControlID="caleto" Format="yyyy-MM-dd">
</cc1:CalendarExtender>
<asp:CompareValidator ID="CompareValidator1" runat="server" Format="yyyy-MM-dd"
ControlToCompare="calefrom" ControlToValidate="caleto"
ErrorMessage="To date can not be smaller then from date"
Operator="GreaterThanEqual"></asp:CompareValidator>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="Reason"></asp:Label>
<asp:TextBox ID="txtreason" runat="server"
CssClass="textbox"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtreason"
ErrorMessage="Reason is must for manager to know better"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Send Request" />
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
</asp:Content>
It's your ScriptManager. It should be cc1:ToolkitScriptManager and not asp:ScriptManager. You need the toolkit's scripts for the extenders to work.

File upload for Dynamic Data

I have the following code
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
<DataControls>
<asp:DataControlReference ControlID="FormView1" />
</DataControls>
</asp:DynamicDataManager>
<h2 class="DDSubHeader">
Edit entry from table
<%= table.DisplayName %></h2>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
HeaderText="List of validation errors" CssClass="DDValidator" />
<asp:DynamicValidator runat="server" ID="DetailsViewValidator" ControlToValidate="FormView1"
Display="None" CssClass="DDValidator" />
<asp:FormView runat="server" ID="FormView1" DataSourceID="DetailsDataSource" DefaultMode="Edit"
OnItemCommand="FormView1_ItemCommand" OnItemUpdated="FormView1_ItemUpdated" RenderOuterTable="false"
OnPageIndexChanging="FormView1_PageIndexChanging">
<EditItemTemplate>
<table id="detailsTable" class="DDDetailsTable" cellpadding="6">
<asp:DynamicEntity runat="server" Mode="Edit" />
<tr class="td">
<td colspan="2">
<asp:LinkButton runat="server" CommandName="Update" Text="Update" />
<asp:LinkButton runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
<br />
</td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Label ID="lblMessage" runat="server">
</asp:Label>
<asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" />
</td>
</tr>
</table>
</EditItemTemplate>
<EmptyDataTemplate>
<div class="DDNoItem">
No such item.</div>
</EmptyDataTemplate>
</asp:FormView>
<asp:LinqDataSource ID="DetailsDataSource" runat="server" EnableUpdate="true" />
<asp:QueryExtender TargetControlID="DetailsDataSource" ID="DetailsQueryExtender"
runat="server">
<asp:DynamicRouteExpression />
</asp:QueryExtender>
</ContentTemplate>
</asp:UpdatePanel>
This file was generate using Dynamic Data. I am trying to add a file upload control in the form but in the code behind I can't acces 'FileUpload1' to see if it contains elements.
How can I do that?
If I make a new form it works but I can't get it out to work in my existing form.
<form id="form1" runat="server"></form>
It's common issue.
You are trying to upload file on ajax request calling upload from update panel.
But you need full postback to upload it using serious FileUpload or look for javascript based file upload controls.

Resources