Showing posts with label following. Show all posts
Showing posts with label following. Show all posts

Wednesday, March 28, 2012

multiple ScriptManagers on a page

hi there; i've created the following page:

<%@dotnet.itags.org.PageLanguage="VB"MaintainScrollPositionOnPostback="true"AutoEventWireup="true"EnableEventValidation="false" %>

<!DOCTYPEHTMLPUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN"> <htmlxmlns="http://www.w3.org/1999/xhtml">

<headid="Head1"runat="server">

<title>Welcome</title>

<scriptlanguage="VB"runat="server">

ProtectedSub RedirectUser(ByVal senderAs System.Object,ByVal eAs System.EventArgs)

Dim tempID = ddlTemp.SelectedItem.Value

Response.Redirect("default.aspx?tempID=" & tempID)

EndSub

</script>

</head>

<body>

<formid="frm"defaultfocus="txtTemp"runat="server">

<atlas:ScriptManagerID="ScriptManager1"runat="server"/>

<divclass="index"> <center>

<tablewidth="100%"height="100%"border="0"cellpadding="0"cellspacing="0">

<tr>

<td>

<divstyle="width:615px; text-align:left;">

<atlasToolkit:CascadingDropDownID="CascadingDropDown1"runat="server">

<atlasToolkit:CascadingDropDownPropertiesLoadingText="Loading"Category="B"TargetControlID="ddlB"

ServiceMethod="GetB"ServicePath="WebService.asmx"PromptText="Please select"/>

<atlasToolkit:CascadingDropDownPropertiesCategory="A"TargetControlID="ddlA"

ParentControlID="ddlB"LoadingText="Loading"ServiceMethod="GetA"ServicePath="WebService.asmx"

PromptText="Please select"/>

</atlasToolkit:CascadingDropDown>

<asp:DropDownListID="ddlB"runat="server"/>

<asp:DropDownListID="ddlA"AutoPostBack="true"OnSelectedIndexChanged="RedirectUser"runat="server"/>

<divstyle="margin-top:25px;">

<asp:TextBoxID="txtTemp"runat="server"></asp:TextBox>

<asp:ButtonID="cmdFindTemp"CssClass="submit"UseSubmitBehavior="false"OnClientClick="this.disabled = true; this.value = 'Submitting...';"runat="server"PostBackUrl="default.aspx"Text="Go!"/>

<atlas:AutoCompleteExtenderID="AutoCompleteExtender1"runat="server">

<atlas:AutoCompletePropertiesServicePath="WebService.asmx"ServiceMethod="GetTemp"TargetControlID="txtTemp"Enabled="true"MinimumPrefixLength="1"/></atlas:AutoCompleteExtender>

</div>

</div>

</td>

</tr>

</table>

</center>

</div>

</form> </body>

</html>

this page basically displays a couple of dropdown lists, a textbox and a submit button.

as you can see, i'm using the atlas control and the atlas toolkit control.

to make the controls function, i'm using the atlas:Scriptmanager.

using asp:scriptmanager (instead of an atlas:Scriptmanager) causes my page to crash with the following error message:

Extender controls require a ScriptManager to be present on the page.
Parameter name: scriptManager

what's worse is that if i try to add an ajaxToolkit control, such as:

<ajaxToolkit:TextBoxWatermarkExtenderID="TextBoxWatermarkExtender1"runat="server"TargetControlID="txtTemp"WatermarkText="Type Name Here"WatermarkCssClass="watermarked"></ajaxToolkit:TextBoxWatermarkExtender>

then i get the following error:

The control with ID 'TextBoxWatermarkExtender1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

well, the atlas:ScriptManager is before it and, again, i still get an error if i try using the asp:ScriptManager.

my question is, how many different scriptmanager's are there and what can i use that cover's all controls (i.e. ajax, ajaxToolbarKit, atlasToolbarKit)

thanks all.

Hi Chubbs,

Your problem is caused by the confilict between Atlas(previous version of Asp.Net Ajax Extension) and Asp.Net Ajax Extension. Ajax ControlToolkit works depend on Asp.Net Ajax Extension 1.0. So why not convert your application from "Atals" to "Asp.Net AJAX RTM" since it is more powerful and stable. It is recommended to update your Asp.Net Ajax Extension and Ajax ControlToolkit to the latest version.

Here is the way: http://ajax.asp.net/documentation/Migration_Guide_CTP_to_RTM.aspx

By can download the lastest released version here:http://ajax.asp.net/downloads/default.aspx?tabid=47

Hope it helps.


hi, jonathan; thanks for the response.

well, it took me several hours to tweak and work out the ensuing glitches, but it finally paid off. much cleaner now.

anyway, for the benefit of those who have the same issue, i will post my final working code.

basically, i have 2 cascading dropdowns that each receive their data from a database.

DROPDOWN.ASPX

======================================

<%@.PageLanguage="VB"MaintainScrollPositionOnPostback="true"AutoEventWireup="true"EnableEventValidation="false" %>

<!DOCTYPEHTMLPUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headid="Head1"runat="server">

<title>Cascading Drop Down</title>

<scriptlanguage="VB"runat="server">

</script>

<linkhref="styles.css"rel="stylesheet"type="text/css"/>

</head>

<bodyclass="index">

<formid="frmIndex"defaultfocus="txtCompany"runat="server">

<asp:ScriptManagerID="ScriptManager1"runat="server"/>

<divid="index">

<center>

<tablewidth="100%"height="100%"border="0"cellpadding="0"cellspacing="0">

<tr>

<td>

<divstyle="width:630px; text-align:right;">

<ajaxToolkit:CascadingDropDown

LoadingText="Loading Provinces"

Category="Province"

ID="CascadingDropDown1"

TargetControlID="ddlProvince"

ServiceMethod="GetProvinces"

ServicePath="WebService.asmx"

PromptText="Please select a province"

runat="server"/>

<ajaxToolkit:CascadingDropDown

LoadingText="Loading Cities"

ParentControlID="ddlProvince"

Category="City"

ID="CascadingDropDown2"

TargetControlID="ddlCity"

ServiceMethod="GetCities"

ServicePath="WebService.asmx"

PromptText="Please select a city"

runat="server"/>

<asp:DropDownListID="ddlProvince"runat="server"/>

<asp:DropDownListID="ddlCity"AutoPostBack="true"OnSelectedIndexChanged="RedirectUser"runat="server"/>

</div>

</td></tr>

</table>

</center>

</div>

</form>

</body>

</html>

WEBSERVICE.VB

======================================

Imports System.Web

Imports System.Web.Services

Imports System.Web.Services.Protocols

Imports System.Collections.Generic

Imports AjaxControlToolkit

Imports System.Data

Imports System.Data.SqlClient

Imports System.Collections

Imports System.Collections.Specialized<WebService(Namespace:="http://tempuri.org")> _

<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

<System.Web.Script.Services.ScriptService()> _

PublicClass WebServiceInherits System.Web.Services.WebService

<WebMethod()> _

PublicFunction GetProvinces(ByVal knownCategoryValuesAsString,ByVal categoryAsString)As AjaxControlToolkit.CascadingDropDownNameValue()

Dim valuesAsNew System.Collections.Generic.List(Of AjaxControlToolkit.CascadingDropDownNameValue)

Dim myDatasetAs DataSet

myDataset = HttpContext.Current.Cache("tblProvince")

If myDatasetIsNothingThen

Dim myConnectionAsNew SqlConnection(ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString)

Dim myCommandAsNew SqlCommand("SELECT * FROM tblProvince", myConnection)

Dim myAdapterAsNew SqlDataAdapter(myCommand)

myDataset =New DataSet

myAdapter.Fill(myDataset)

HttpContext.Current.Cache.Insert("tblProvince", myDataset)

Else

myDataset =CType(HttpContext.Current.Cache("tblProvince"), DataSet)

EndIf

ForEach rowAs DataRowIn myDataset.Tables(0).Rows

values.Add(New CascadingDropDownNameValue(row("fldProvince"), row("fldProvinceID")))

Next

Return values.ToArray

EndFunction

<WebMethod()> _

PublicFunction GetCities(ByVal knownCategoryValuesAsString,ByVal categoryAsString)As CascadingDropDownNameValue()

Dim kvAs StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)

IfNot (kv.ContainsKey("Province"))Then

ReturnNothing

EndIf

Dim valuesAsNew System.Collections.Generic.List(Of AjaxControlToolkit.CascadingDropDownNameValue)

Dim myConnectionAsNew SqlConnection(ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString)

Dim strSQLAsString ="SELECT * FROM tblCity WHERE (tblCity.fldProvinceID='" & kv("Province") &"')"

Dim myCommandAsNew SqlCommand(strSQL, myConnection)

Dim myAdapterAsNew SqlDataAdapter(myCommand)

Dim myDatasetAsNew DataSet

myAdapter.Fill(myDataset)

ForEach rowAs DataRowIn myDataset.Tables(0).Rows

values.Add(New CascadingDropDownNameValue(row("fldCity"), row("fldCityID")))

Next

Return values.ToArrayEndFunction

EndClass

WEB.CONFIG

======================================

<?xmlversion="1.0"?>

<configuration>

<configSections>

<sectionGroupname="system.web.extensions"type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<sectionGroupname="scripting"type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<sectionname="scriptResourceHandler"type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="MachineToApplication"/>

<sectionGroupname="webServices"type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<sectionname="jsonSerialization"type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="Everywhere" />

<sectionname="profileService"type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="MachineToApplication" />

<sectionname="authenticationService"type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="MachineToApplication" />

</sectionGroup>

</sectionGroup>

</sectionGroup>

</configSections>

<connectionStrings>

<addname="myConnectionString"connectionString="Data Source={SQLServer};Server=yourServer;Database=yourDatabase;Uid=yourID;Pwd=yourPassword;"/>

</connectionStrings>

<system.web>

<pages>

<controls>

<addnamespace="System.Web.UI"tagPrefix="asp"assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addnamespace="AjaxControlToolkit"assembly="AjaxControlToolkit"tagPrefix="ajaxToolkit"/>

<addnamespace="AtlasControlToolkit"assembly="AtlasControlToolkit"tagPrefix="atlasToolkit"/>

<addnamespace="System.Data"tagPrefix="asp"/>

<addnamespace="System.Data.SQLClient"tagPrefix="asp"/>

</controls></pages>

<compilationdebug="true">

<buildProviders>

<addextension=".asbx"type="Microsoft.Web.Services.BridgeBuildProvider"/>

</buildProviders>

<assemblies>

<addassembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addassembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

<addassembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<addassembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

</assemblies>

</compilation>

<httpHandlers>

<removeverb="*"path="*.asmx"/>

<addverb="*"path="*.asmx"validate="false"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addverb="*"path="*_AppService.axd"validate="false"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addverb="GET,HEAD"path="ScriptResource.axd"type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"validate="false"/></httpHandlers>

<customErrorsmode="Off"/>

<httpModules>

<addname="ScriptModule"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</httpModules>

</system.web>

<system.web.extensions>

<scripting>

<webServices>

<!-- Uncomment this line to customize maxJsonLength and add a custom converter-->

<!--

<jsonSerialization maxJsonLength="500">

<converters>

<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>

</converters>

</jsonSerialization>

-->

<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate.-->

<!--

<authenticationService enabled="true" requireSSL = "true|false"/>

--><!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved

and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and

writeAccessProperties attributes.-->

<!--

<profileService enabled="true"

readAccessProperties="propertyname1,propertyname2"

writeAccessProperties="propertyname1,propertyname2" />

-->

</webServices>

</scripting></system.web.extensions>

<system.webServer>

<validationvalidateIntegratedModeConfiguration="false"/>

<modules>

<addname="ScriptModule"preCondition="integratedMode"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</modules>

<handlers>

<removename="WebServiceHandlerFactory-ISAPI-2.0"/>

<addname="ScriptHandlerFactory"verb="*"path="*.asmx"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addname="ScriptHandlerFactoryAppServices"verb="*"path="*_AppService.axd"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addname="ScriptResource"preCondition="integratedMode"verb="GET,HEAD"path="ScriptResource.axd"type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

</handlers>

</system.webServer>

</configuration>

Well, there it is in it's entirety. Hopefully this will help someone get up and running with this control in the future.

Good luck!

Multiple update panels with triggers

I'm having a hard time figuring out how to accomplish the following. Any help would be GREATLY appreciated:

I have a section with radiobuttonlists and checkboxes. I wrapped them in an updatepanel and they work great.

The problem is that the radiobuttonlists and checkboxes also have customvalidators on them, which unfortunately doesn't work correctly. My validatorsummary is at the bottom of the page and is not included in the updatepanel. What do I need to do to get all this to work properly?

Thanks!

In what way is it not working properly?


If they aren't in an UpdatePanel, they can't update as result of a partial postback. One thing you can do is put them in another UpdatePanel with async postback triggers for the checkboxes and radiobuttons.

hi

Do have try to use ValidatorCallout control of ajax control toolkit i think it may help you


DisturbedBuddha:

In what way is it not working properly?

On the custom validator, I set text="*" and errorMessage="Danger Will Robinson"... I see the * next to the control that is in the updatePanel, but the error message does not display in the validatorsummary, which is outside of the updatePanel


qt1329a is slightly mistaken. The validation summary should appear even if not placed in an update panel. Validation always occurs on the server, but unless you've specifically disabled client-side validation, it will validate in the browser first and cancel the post to the server if there is a problem. For an in-depth explanation of how that works, read "Client-Side Validation" athttp://quickstarts.asp.net/QuickStartv20/aspnet/doc/validation/default.aspx. So basically, a postback is not usually required for a validator to fire.

Some versions of the validators (as well as other controls) are not compatible with the UpdatePanel. You can try this fix: http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx

But in the meantime, you could post your source code and I can see if it's just a simple correction.

multiple updatepanels, AsyncPostbackTrigger fails when referenced from more then 1 panel

Im using the latest Beta1, both core and CTP and toolkit, none of the old dll's exist on the system

Im not sure if the following issue is by design or if its a bug,


I have 3 updatepanels on the page, call them p1, p2 and p3 to make it easy to understand
first 2 panels contain a gridview, and a few other controls, p3 contains a couple of dropdowns and a linkbutton (lnk_insert)
when lnk_insert is clicked a new row gets added to gridview in p2 and the updatepanel forp2 contains the following trigger

<Triggers>
<asp:AsyncPostbackTrigger ControlID="lnk_insert" EventName="Click" />
</Triggers
the codebehind takes care of the database stuff and rebinds grid in p2, the page displays correctly and the trigger works fine so far, p2 gets updated
now the trouble - p1 contains a grid as well, whose data depends on grid in P2 (some summary info), the data gets prepared & returned correctly, (verified via debug) and is bound to grid via gridviewXXX.Databind,
p1 updatepanel contains the same

<Triggers>
<asp:AsyncPostbackTrigger ControlID="lnk_insert" EventName="Click" />
</Triggers
referencing the same link button, howeverp1does not update its contents,
different render modes in panel, and forced update of p1 via codebehind didnt help

no error messages come up, no javascript errors in browser either

which makes me think, is it possibly to reference the same control from 2 different updatepanels via asynctrigger ? or is one just overwriting the hooks to the other and thats why one of them doesnt trigger the refresh,

any tips ? thanks in advance

hello.

triggers can be associated with several panels. the following sample demonstrates that:

<%@. Page Language="C#" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" id="manager" />
<asp:UpdatePanel runat="server" ID="panel1" UpdateMode="Conditional">
<ContentTemplate>
<span>UpdatePanel 1: <%=DateTime.Now.ToString( ) %></span>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="bt" EventName="Click" />
</Triggers>
</asp:UpdatePanel>

<asp:UpdatePanel runat="server" ID="panel2" UpdateMode="Conditional">
<ContentTemplate>
<span>UpdatePanel 2: <%=DateTime.Now.ToString( ) %></span>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="bt" EventName="Click" />
</Triggers>
</asp:UpdatePanel>

<asp:UpdatePanel runat="server" ID="panel3" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<span>UpdatePanel 3: <%=DateTime.Now.ToString( ) %></span>
<asp:LinkButton runat="server" ID="bt" Text="Refresh" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>

can you build a small sample that reproduces the problem you're having?


Thanks for the prompt response and code sample, I figured out the problem, (I glued my code into your sample app , which helped locate the problem - it was my fault)

one of the databind's was pointing to the wrong grid - the 3 updatepanels work together as expected and have 2 triggers each

very nice, the attached is the full page, - certainly it wont run without the codebehind, but thats quite lengthy

bottom line multiple updatepanel can have multiple triggers even if (some) of the triggers reference the same control - works fine

<Triggers>

<asp:AsyncPostBackTriggerControlID="bt"EventName="Click"/>

<asp:AsyncPostBackTriggerControlID="gv_group"EventName="SelectedIndexChanged"/>

</Triggers>

<%@.PageLanguage="vb"AutoEventWireup="false"CodeBehind="3updatepanels.aspx.vb"Inherits="schedule._3updatepanels"StylesheetTheme="Default" %>

<%@.RegisterSrc="../controls/nav_main.ascx"TagName="nav_main"TagPrefix="uc1" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<asp:ScriptManagerrunat="server"id="manager"/>

<uc1:nav_mainID="Nav_main1"runat="server"/>

<divclass="filter">

<tableborder=1cellspacing=1cellpadding=1width=100%align=center>

<tr>

<td><h2>Groups</h2></td>

<td>Group Name

<asp:TextBoxID="txt_groupname"runat="server"></asp:TextBox></td>

<td>Contains Resource

<asp:DropDownListID="dd_resource"runat="server"AppendDataBoundItems=TrueDataSourceID="dsrc_resourcenames"DataTextField="name"DataValueField="pk_resource">

<asp:ListItemText="All"Value="0"></asp:ListItem>

</asp:DropDownList></td>

<td> Total Items =

<asp:LabelID="lbl_numItems"runat="server"></asp:Label></td>

<td>

<asp:ImageButtonID="btn_refresh"runat="server"ImageUrl="~/images/loader_36.gif"/></td>

</tr>

</table>

</div>

<asp:UpdatePanelrunat="server"ID="panel1"UpdateMode="Conditional">

<ContentTemplate>

<span>UpdatePanel 1: <%=DateTime.Now.ToString( ) %></span>

<asp:GridViewID="gv_group"runat="server"AutoGenerateColumns="False"DataKeyNames="pk_groupname"

DataSourceID="ds_groups"SkinID="BlueSky"AllowSorting=True>

<Columns>

<asp:CommandFieldShowSelectButton="True"/>

<asp:BoundFieldDataField="name"HeaderText="Group Name"SortExpression="name"/>

<asp:BoundFieldDataField="NumItems"HeaderText="Number of Resources"ReadOnly="True"SortExpression="NumItems"ItemStyle-HorizontalAlign=Center/>

<asp:CommandFieldShowDeleteButton=TrueButtonType=ImageDeleteImageUrl="~/images/cancel.gif"ShowEditButton=TrueEditImageUrl="~/images/edit.gif"CancelImageUrl="~/images/cancel.gif"UpdateImageUrl="~/images/confirm_16.gif"/>

</Columns>

</asp:GridView>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTriggerControlID="bt"EventName="Click"/>

<asp:AsyncPostBackTriggerControlID="gv_GroupResources"EventName="RowCommand"/>

</Triggers>

</asp:UpdatePanel>

<tablewidth="100%"cellpadding="0"cellspacing="1"bgcolor="gainsboro">

<tr>

<tdbgcolor="whitesmoke"height="25"><imgid="plusminus"src="../images/plus.gif"align="absMiddle"/>

<b>Add New Group :

<asp:TextBoxID="txt_insertname"runat="server"></asp:TextBox>

<asp:LinkButtonID="btn_insert"runat="server">Insert</asp:LinkButton>

</b>

<asp:LabelID="lbl_msg"runat="server"EnableViewState="False"ForeColor="Red"></asp:Label>

</td>

</tr>

</table>

<asp:ObjectDataSourceID="ds_groups"runat="server"DeleteMethod="Delete"InsertMethod="Insert"

SelectMethod="GetDataByWhere"TypeName="schedule.MainTableAdapters.T_GroupNameTableAdapter"

UpdateMethod="Update">

<DeleteParameters>

<asp:ParameterName="pk_groupname"Type="Int32"/>

</DeleteParameters>

<UpdateParameters>

<asp:ParameterName="pk_groupname"Type="Int32"/>

<asp:ParameterName="name"Type="String"/>

</UpdateParameters>

<InsertParameters>

<asp:ParameterName="name"Type="String"/>

<asp:ParameterDirection="InputOutput"Name="pk_groupname"Type="Object"/>

</InsertParameters>

<SelectParameters>

<asp:ParameterName="WhereCondition"Type=string/>

<asp:ParameterDefaultValue="[name]"Name="OrderByExpression"Type="String"/>

</SelectParameters>

</asp:ObjectDataSource>

<asp:SqlDataSourceID="dsrc_resourcenames"runat="server"CacheDuration="120"ConnectionString="<%$ ConnectionStrings:schedule.My.MySettings.conn_Schedule %>"

EnableCaching="True"SelectCommand="SELECT [pk_resource], [name] FROM [T_Resource] ORDER BY [name]">

</asp:SqlDataSource>

<br/>

<tablewidth="100%"cellpadding="0"cellspacing="1"bgcolor="gainsboro">

<tr>

<tdbgcolor="whitesmoke"height="25"><imgid="Img1"src="../images/plus.gif"align="absMiddle"/>

<b>Resources Part of This Group :</b>

</td>

</tr>

</table>

<asp:UpdatePanelrunat="server"ID="panel2"UpdateMode="Conditional">

<ContentTemplate>

<span>UpdatePanel 2: <%=DateTime.Now.ToString( ) %></span>

<asp:GridViewID="gv_GroupResources"runat="server"AutoGenerateColumns="False"

DataSourceID="dsrc_groupresources"SkinID=BlueSkyDataKeyNames="pk_group2resource">

<EmptyDataTemplate>

<h3>None.</h3>

</EmptyDataTemplate>

<Columns>

<asp:CommandFieldShowDeleteButton="True"DeleteText="Remove"/>

<asp:BoundFieldDataField="name"HeaderText="Name"SortExpression="name"/>

<asp:TemplateFieldHeaderText="Location"SortExpression="fk_location">

<ItemTemplate>

<%#lookup.L_Location(Eval("fk_location") - 1)("name").ToString%>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateFieldHeaderText="OutputType"SortExpression="fk_outputType">

<ItemTemplate>

<imgborder=0src='../images/<%#lookup.Outputtype(Eval("fk_outputtype")-1)("icon").ToString%>'align=absbottom/>

<%#lookup.Outputtype.Item(eval("fk_outputtype")-1)("outputtype").ToString %>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateFieldHeaderText="Status"SortExpression="fk_status">

<ItemTemplate>

<imgborder=0src='<%#GetResourceStatus(Eval("fk_status"), "icon")%>'align=absbottom/>

<%#GetResourceStatus(Eval("fk_status"),"name")%>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateFieldHeaderText="Type"SortExpression="fk_type">

<ItemTemplate>

<imgborder=0src='<%# getResourceType(Eval("fk_type"),"icon") %>'align=absbottom/>

<%# getResourceType(Eval("fk_type"),"name") %>

</ItemTemplate>

</asp:TemplateField>

</Columns>

</asp:GridView>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTriggerControlID="bt"EventName="Click"/>

<asp:AsyncPostBackTriggerControlID="gv_group"EventName="SelectedIndexChanged"/>

</Triggers>

</asp:UpdatePanel>

<asp:ObjectDataSourceID="dsrc_groupresources"runat="server"DeleteMethod="Resource_DeleteFromGroupbyPK"

SelectMethod="GetData"

TypeName="schedule.MainTableAdapters.Resource_SelectGroupbyGroupPKTableAdapter">

<DeleteParameters>

<asp:ParameterName="pk_group2resource"Type="Int32"/>

</DeleteParameters>

<SelectParameters>

<asp:ControlParameterControlID="gv_group"Name="pk_group"PropertyName="SelectedValue"

Type="Int32"/>

</SelectParameters>

</asp:ObjectDataSource>

<br/>

<tablewidth="100%"cellpadding="0"cellspacing="1"bgcolor="gainsboro">

<tr>

<tdbgcolor="whitesmoke"height="25"><imgid="Img2"src="../images/plus.gif"align="absMiddle"/>

<b>Add Resource to this Group :</b></td>

</tr>

<tr>

<td>

<divid="divAdd"style="DISPLAY:inline;">

<asp:UpdatePanelrunat="server"ID="panel3"UpdateMode="Conditional"ChildrenAsTriggers="false">

<ContentTemplate>

<span>UpdatePanel 3: <%=DateTime.Now.ToString( ) %></span>

Filter Location :<asp:DropDownListID="dd_add_location"runat="server"AutoPostBack=trueAppendDataBoundItems=trueOnSelectedIndexChanged="dd_add_location_SelectedIndexChanged">

<asp:ListItemText="All"Value="0"></asp:ListItem>

</asp:DropDownList>

Filter OutputType :

<asp:DropDownListID="dd_add_outputtype"runat="server"AutoPostBack=trueAppendDataBoundItems=trueOnSelectedIndexChanged="dd_add_outputtype_SelectedIndexChanged">

<asp:ListItemText="All"Value="0"></asp:ListItem>

</asp:DropDownList>

<br/>

Resource Name :

<asp:DropDownListID="dd_add_resource"runat="server"DataSourceID="dsrc_filter_resources"DataTextField="name"DataValueField="pk_resource">

</asp:DropDownList>

<asp:LinkButtonID="btn_add_resource"runat="server"OnClick="btn_add_resource_Click">Add to Group</asp:LinkButton>

<asp:LabelID="lbl_msg2"runat="server"EnableViewState="False"ForeColor="Red"></asp:Label>

<asp:LinkButtonrunat="server"ID="bt"Text="Refresh"OnClick="bt_Click"/>

</ContentTemplate>

</asp:UpdatePanel>

</div></td>

</tr>

</table>

<asp:SqlDataSourceID="dsrc_filter_resources"runat="server"ConnectionString="<%$ ConnectionStrings:schedule.My.MySettings.conn_Schedule %>"

DataSourceMode="DataReader"SelectCommand="SELECT [pk_resource], [name] FROM [T_Resource] ORDER BY [name]">

</asp:SqlDataSource>

</form>

</body>

</html>


When you have multiple UpdatePanels having the same Trigger, all of the update panels will update, but is the processing really async or not? I am asking as I need to have one trigger ('search button') which triggers updating multiple UpdatePanels, AND I would like to detect when each of the UpdatePanels has been updated so I can indicate this outside of the individual UpdatePanels (each UpdatePanel has an associated 'tab' where an animated image displays while the request is running). The PageRequestManager (and it's endRequest) does not seem to help as it will only fire once (with an array of the names of all of the updated UpdatePanels available). I would like a way to trigger separate 'requests' (and react to the ending of each one separately). Thoughts?
hello.
nop. they're all updated udring the same postback. that's why you're getting the results you describe.

Monday, March 26, 2012

MultiRequestHandler removing FORM POST parameters

Hi,


My page can not find any parameters sent using the POST methed when the following ATLAS code is contained in the web.config file:

<!-- The MultiRequestHandler enables multiple requests to be handled in one roundtrip to the server. Its use requires Full Trust.-->
<add verb="*" path="atlasbatchcall.axd" type="Microsoft.Web.Services.MultiRequestHandler" validate="false"/>
<add verb="*" path="atlasglob.axd" type="Microsoft.Web.Globalization.GlobalizationHandler" validate="false"/>
<add verb="*" path="*.asbx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>

All GET parameters are not effected.

Does anyone know how I can resolve this?

Regards

Parlster

Got it.

I misinterpretated the issue.

POST variables are removed when the Session state management is set to Cookieless:

<sessionStatecookieless="true"/>

The lost variables can be found by using GET submission or using Cookies to manage the Session:

<sessionStatecookieless="AutoDetect"/>

Regards

Parlster

MultiView in PopupControlExtender ?

I am trying to decide which ajaxtoolkit control to use for the following and if someone can point me to the correct direction, it would help alot.

I want to create poup window when click on a linkbutton. The popup window include asp.net server controls such as multiview or wizard which required popup to stay open even after the postback.

basically

1.user click on the linkbutton to open up popup window.

2. user fill up information on first view of the multiview and click next to go to next view

(catch the button next action on server side and do some action such as write to database, then change the multiview active index to second view)

3. user is provided with second view of the multiview while the popup still open

I can't use hovermenuextender because i want the popup to display when click action happened

I am trying out the popupcontrolextender but it close the popup window after user click next ( 2 ).

Here is the code, i have it so far.
123<asp:LinkButton ID="LinkButton1" runat="server" Text="Open Popup" />4<asp:Panel ID="Panel1" runat="server" CssClass="PopupStyle">5<asp:UpdatePanel runat="server" ID="UpdatePanel3">6 <ContentTemplate>78 <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">9 <asp:View ID="View1" runat="server">10 View111 <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="btn_next.gif" />12 </asp:View>13 <asp:View ID="View2" runat="server">14 View215 <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="btn_complete.gif" />16 </asp:View>17 </asp:MultiView>18 </ContentTemplate>19 </asp:UpdatePanel>20 </asp:Panel>21<ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server" TargetControlID="LinkButton1"22 PopupControlID="Panel1" Position="Bottom" >23</ajaxToolkit:PopupControlExtender>

With this code, it always close the popup after ImageButton1 in View1 is clicked. So i tried putting another updatepanel to wrapped the whole thing, once i do that the button click doesn't go back to server anymore.

What i am looking for exactly is an ajaxtoolkit control that create popup on clicked that can have any asp.net server control and stay open until user click close or certain button.

Any suggestion is appreciated.

thanks!


I guess i make it confused with my specific case. but it is quite simple what i want to do. so let me rephrase my question.

"Does anyone know which ajaxtoolkit control to use to create sticky popup with server controls which require postback?"


Really appreciate any suggestion even if there is no such control, please let me know.

Thanks very much.


Hi,

By default, popup extender doesn't support this behavior, but you can enable it by wrapping the wizard in a UpdatePanel.

Here is a sample that works:

<%@. Page Language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) MultiView1.SetActiveView(View2) End Sub</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:LinkButton ID="LinkButton1" runat="server" Text="Open Popup" /> <asp:Panel ID="Panel1" runat="server" CssClass="PopupStyle"> <asp:UpdatePanel runat="server" ID="UpdatePanel3"> <ContentTemplate> <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"> <asp:View ID="View1" runat="server"> View1<asp:Button ID="Button1" runat="server" Text="Next" UseSubmitBehavior="false" OnClick="Button1_Click" /> </asp:View> <asp:View ID="View2" runat="server"> View2 <asp:Button ID="Button2" runat="server" Text="Complete" UseSubmitBehavior="false"/> </asp:View> </asp:MultiView> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> <ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server" TargetControlID="LinkButton1" PopupControlID="Panel1" Position="Bottom" > </ajaxToolkit:PopupControlExtender> </div> </form></body></html>
Hope this helps.

Thanks you Raymond for the reply. Just in case someone wondering how this goes. Here is what i ended up with. There is one that worth mentioning here. The property UseSubmitBehavior is a must so you must used button or similar control. The main problem that i have before was using imagebutton. I was using two updatedpanel nested and somehow imagebutton never make the server call. but the button did with UseSubmitBehavior set to false.

1 <asp:ScriptManager ID="ScriptManager1" runat="server">
2 </asp:ScriptManager>
3 <asp:UpdatePanel runat="server" ID="UpdatePanel1">
4 <ContentTemplate>
5 <asp:LinkButton ID="LinkButton1" runat="server" Text="Open Popup" />
6 <asp:Panel ID="Panel1" runat="server" CssClass="PopupStyle">
9 <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
10 <asp:View ID="View1" runat="server">
11 View1
12 <asp:Button ID="Button1" runat="server" Text="Next" UseSubmitBehavior="false" OnClick="Button1_Click"
13 CssClass="ButtonSubmit" />
14 </asp:View>
15 <asp:View ID="View2" runat="server">
16 View2
17 <asp:Button ID="Button2" runat="server" Text="Complete" UseSubmitBehavior="false"
18 CssClass="ButtonComplete" />
19 </asp:View>
20 </asp:MultiView>
23 </asp:Panel>
24 <ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server" TargetControlID="LinkButton1"
25 PopupControlID="Panel1" Position="Bottom">
26 </ajaxToolkit:PopupControlExtender>
27 </ContentTemplate>
28 <Triggers>
29 <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
30 <asp:PostBackTrigger ControlID="Button2" />
31 </Triggers>
32 </asp:UpdatePanel>

thanks for the helps. hope this help someone also.

Must have a <head runat="server"> Error

When i use<atlas:ScriptManager> tag in .aspx or .ascx pages without <head runat =server> , i get the following error. Is this a bug or as designed?

Server Error in '/AtlasWebSite' Application.

Must have a <head runat="server">

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.InvalidOperationException: Must have a <head runat="server"
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[InvalidOperationException: Must have a <head runat="server">] Microsoft.Web.UI.ScriptManager.OnPreRender(EventArgs e) +262 System.Web.UI.Control.PreRenderRecursiveInternal() +77 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360



Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

As designed, you need that runat attribute.
I got this too (which is easily fixed by making the head runat="server") but is this a requirement on any page using Atlas?

LordHits wrote:

but is this a requirement on any page using Atlas?

Hi,

no it isn't. If you're using Themes in ASP.NET 2.0 it's required to have that attribute.

Grz, Kris.


But i am not using any themes in my website which is fairly simple ASP.NET 2.0 impelementation. Infact i am using Atlas in .ascx control and .ascx control is loaded first then the page, as a result scripmanager is unable to see the <head runat=server> tag and generates this error.

Any clue?


XIII wrote:

Hi,

no it isn't. If you're using Themes in ASP.NET 2.0 it's required to have that attribute.

Grz, Kris.

Ok, but i'm not using themes and I still go that message. I don't know if it matters, but my scriptmanager control resides in a content page as opposed to the master page.


Hi,

I had the same problem. An .aspx page with a placeholder, loading an ascx control in code behind.

I replace the <head> section in my aspx page with<headid="headSection"runat="server">, and now it works.

As the ascx control had an updatepanel, i had to do the loadcontrol in the page-init method.

Hope that will solve your pb.

Gilles


hello guys.

i believe that the head element must be a server element since it's one of the sections that is sent back from the server to the client during a partial postback (ie, it's contents are parsed and send on every partial postback response).


Hi,

If you are using Master pages.. then have to make sure that <head runat="server"> is there in the master page.

regards,

ukv

Saturday, March 24, 2012

My MaskedEditValidator doesnt seem to want to work

I have the following code...

<asp:TextBoxID="txtPhone"runat="server"skinid="txtGeneralText"/>

<cc1:maskededitextenderrunat="server"id="mePhoneNumber"targetcontrolid="txtPhone"mask="(999) 999-9999"masktype="Number"clearmaskonlostfocus="false"/>

<cc1:maskededitvalidatorrunat="server" id="mePhoneNumberValidator"controltovalidate="txtPhone"controlextender="mePhoneNumber"errormessage="You must enter a Phone Number"display="None"ValidationExpression="^\([2-9]\d{2}\)\s\d{3}\-\d{4}$"validationgroup="PhoneValidators"/>

<cc1:validatorcalloutextenderrunat="server"id="vPhoneExtender"targetcontrolid="mePhoneNumberValidator"/>

The validator keeps returning "You must enter a Phone Number" even after a valid phone number is entered

I have tried everything, but I am obviously missing something

Can anyone help ?

Thanks

Brian

I've been having similar problems with validators working correctly until I removed the ValidationGroup. Try that and see if it helps.

Rick

Naming Convention to search for a control with $get

Is there another way to find a control when using a master page and a tabContainer ?

For now I'm using the following syntax in Ajax client script:

$addHandler($get("ctl00$myContentPlaceHolder$myTabContainer$myTab1$txtPostalCode"), "keyup",mapPostalCode);

It's a little long, no ??

Thank you !

Gerrie

I usually embed the control.ClientID in a javascript variable if I need it, like so:

var txtPostalCode = "<%= txtPostalCode.ClientID %>";

Note this only works (afaik) inside on-page script tags or in an embedded .js file (from an assembly), or in a registered script block.


Great!

$addHandler($get("<%= txtPostcalCode.ClientID %>"),"keyup", mapPostalCode);

it works !!!

Thanks for this little annoying problem... sometimes little things keep me awake :-)

Wednesday, March 21, 2012

Need help getting javascript widget to work

I'm trying to get the following to work in my ASP .NET AJAX site:

dhtmlGoodies xpPane

I'd like to use it as a main menu for my site, so this is what my masterpage looks like:

<%@dotnet.itags.org. Master Language="C#" AutoEventWireup="true" CodeFile="Blah.master.cs" Inherits="Blah" %><!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>
<link runat="server" type="text/css" rel="stylesheet" id="cssLink" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" >
<Scripts>
<asp:ScriptReference Path="/Blah/scripts/xpPane.js" />
</Scripts>
</asp:ScriptManager>
<div id="dhtmlgoodies_xpPane">
<div class="dhtmlgoodies_panel>">
<div>
<!-- Start content of pane --> Testing...<br />
Test 1<br />
Test 2<br />
Test 3
<!-- End content --> </div>
</div>
</div>
<script type="text/javascript">initDhtmlgoodies_xpPane(Array('Test Title'), Array(true), Array());</script>
<div>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>

I've seperated the the javascript and css and put them in their own files. I've also put the required images into /Blah/scripts/images/. I added the following to the end of the javascript file:

if (typeof(Sys) !=='undefined'){
Sys.Application.notifyScriptLoaded();
alert("Howdy! I'm an external file.");
}

When I view the page all I see isthis

I do not get any script errors on the page. Also the javascript alert I put in is being shown, so the script is definately being loaded. Any help would be much appreciated! Smile

Hello, i am actually dont know what are you tryting to accomplish from your post. but if you are trying to do the menus. Then just use ASP .NET menu control.

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/navigation/default.aspx

and here is a great video about it:

http://asp.net/learn/videos/view.aspx?tabid=63&id=48


Is there no one here that can get this thing to work? Surely its possible...

Replace " <div class="dhtmlgoodies_panel>">"

with

<div class="dhtmlgoodies_panel">
!

You are so careless!!!!!


I must've read over that line 100 times without noticing the out-of-place angle bracket. Its not so much about carelessness - sometimes it just takes another pair of eyesWink


Thanks for pointing it out, I'll try it later and let you know if it works!!


I've tested it,and found that it worked very well:)

Do you have any question?


Yup it works fine now. Thanks for the help!Big Smile

Need help to implement a web design..new to AJAX

Luckly, I found an example to show what exacty I am looking for:

Go to the following yahoo link:

http://travel.yahoo.com/;_ylc=X3oDMTE5MGRqZDdoBF9TAzI3MTYxNDkEc2VjA2ZwLXRy b3VnaARzbGsDc3Bpcml0LWZpeGVk

There will be a world map in this page

if we click on any continent. it will open a small box with major cities information

I need to implement such design in a web page using AJAX and .net

Dont know how to proceed. Suggestions are very much appreciated.

I am new to AJAX.net. I can write AJAX functions to return the data to javascript but I dont know about populating second box in main window. Can you give further information on what sort of functions are required.

Eagerly waiting for a reply.

Thanks in advance.

Datla20s

Please refer to http://forums.asp.net/p/1166784/1948924.aspx#1948924