Showing posts with label trouble. Show all posts
Showing posts with label trouble. Show all posts

Wednesday, March 28, 2012

Transparent PNG in AdRotator - Applying Behavior

I'm having a bit of trouble with AdRotator. I have images that are transparent PNG files. I created a style that applys the behavior to correct IE6 inability to display transparent PNG images. When I add the reference, images don't appear. They work in FireFox, just not IE6 (I haven't checked IE7). This behavior works everywhere else in the site.

Is there a workaround?

<asp:AdRotator id="AdRotator1" runat="server" borderstyle="None" datasourceid="SqlDataSource2" cssclass="adRotator"></asp:AdRotator>

.adRotator {
behavior: url('/behaviors/pngbehavior.htc');
border: 0px;
padding: 0px;
margin: 0px;
}

You need to haveheight andwidth set in AdRotator or CSS.

Saturday, March 24, 2012

Trouble Adding Toolkit Controls

When I attempt to add a toolkit control, my site crashes. I have non-toolkit ajax controls working just fine, but as soon as I add an extender(always visible) my site crashes.

If I preview it on my developing machine, it works fine, but then I get the following on the production machine:

Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.

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.InvalidCastException: Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.

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:

[InvalidCastException: Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.] System.Web.Configuration.ApplicationSettings.EnsureSectionLoaded() +70 System.Web.Handlers.ScriptResourceHandler.IsCompressionEnabled(HttpContext context) +7 System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) +30 System.Web.UI.ScriptReference.GetUrlFromName(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +293 System.Web.UI.ScriptReference.GetUrl(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +237 System.Web.UI.ScriptManager.RegisterScripts() +507 System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +111 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +2052172 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2247



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

As always, thanks again for all of your helpGeeked

I'm thinking it has something to do with IIS. If I preview it though VS2008's development server, it works fine, but when I run it through IIS is when my heartaches begin...

Trouble building the TemplateVSI template project

I am having lots of trouble building theTemplateVSI template project.

I've downloaded theAjaxControlToolkit.zip source fileand extracted to this folder (as suggested by the getting started video walkthrough) :

C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\AjaxControl Toolkit

I then opened the AjaxControlToolkit.sln solution file, which display the various projects in the Solution Explorer.

In VS2005, once I right-click and "Build" TemplateVSI, I get the following "access denied" type error :

Error 1 Unable to remove directory"C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\AjaxControl Toolkit\TemplateVSI\bin". Access to the path'TemplateVSI.vshost.exe' is denied.

Then I manually removed the \bin\ directory (sinceWindows won't let me remove the read-only attribute), then I got thiserror :

Error 1 Could not load file or assembly'vjslib, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The systemcannot find the file specified. C:\ProgramFiles\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\Ajax ControlToolkit\TemplateVSI\TemplateVSI.csproj 52 5 TemplateVSI

I'd like to use the control kit but I need help getting started.

Thank you,

Bob

New York

<>The video also instructs me to launch TemplateVSI.vscontent, whichattempts to install "Templates & Starter Kits" but of course thezip files the installer is looking are not in my ..\Ajax ControlToolkit\TemplateVSI folder. They are not included in the originalAjaxControlToolkit.zip file I downloaded.

Trouble canceling an Ajax webservice

I have been searching how to cancel a webservice request in javascript and the standard solution does not seem to work for me. I call the webservice like this.

_request = ClientServices.GetPolyListings(myPoints, SearchComplete, SearchFailed);

_request seems to always be undefined after I do this.. I checked the value during through the debugger and even tried sleeping the thread in the webservice to postpone it for testing. Nothing seems to work. I have this code which never executes because its undefined.

if(_request)

_request.get_executor().abort();

Try with:

_request = ClientServices._staticInstance.GetPolyListings(myPoints, SearchComplete, SearchFailed);
Check:
http://geekswithblogs.net/rashid/archive/2007/07/14/Cancel-a-Web-Service-Call-in-Asp.net-Ajax.aspx

Thank you works great. Do not know how I forgot the _staticInstance because I am pretty sure I looked at that site already. Thanks Solved.


Would you pls mark it as answer.

Wednesday, March 21, 2012

Trouble creating ReorderList in codebehind

All,

I am trying to create a ReorderList in the codebehind for a page and am having a rediculous amount of trouble. When I set AllowReorder to 'false' the page displays what it should, but when i set AllowReorder to 'true' I get "Object reference not set to an instance of an object. " on the line where I am doing the databinding. I am using an SqlDataAdapter which implements both SelectCommand and UpdateCommand

This is my first time trying to set one of these up, so i think there is a good chance that I am missing something simple. I am copying and pasting in my code if that helps.

---begin code-----

1using System;2using System.Data;3using System.Configuration;4using System.Web;5using System.Web.Security;6using System.Web.UI;7using System.Web.UI.WebControls;8using System.Web.UI.WebControls.WebParts;9using System.Web.UI.HtmlControls;10using AjaxControlToolkit;11using System.Text;12using System.Data.SqlClient;1314public partialclass _Default : System.Web.UI.Page15{16protected void Page_Load(object sender, EventArgs e)17 {18 SqlConnection conn =new SqlConnection(ConfigurationManager.ConnectionStrings["GLISurveyGenerator_3"].ConnectionString);19 SqlDataAdapter dataadapter =new SqlDataAdapter();2021 SqlCommand selectcommand =new SqlCommand();22 selectcommand.CommandText="spGetPagesForSurvey";23 selectcommand.CommandType = CommandType.StoredProcedure;24 selectcommand.Parameters.Add("@dotnet.itags.org.SurveyID", SqlDbType.Int, 32).Value = 1;25 selectcommand.Connection = conn;2627 SqlCommand updatecommand =new SqlCommand();28 updatecommand.CommandText ="spUpdatePagesForSurvey";29 updatecommand.CommandType = CommandType.StoredProcedure;30 updatecommand.Parameters.Add("@dotnet.itags.org.SurveyPageID", SqlDbType.Int, 32);31 updatecommand.Parameters.Add("@dotnet.itags.org.SurveyPageNumber", SqlDbType.Int, 32);32 updatecommand.Connection = conn;3334 dataadapter.SelectCommand = selectcommand;35 dataadapter.UpdateCommand = updatecommand;3637 DataSet ds1 =new DataSet();3839 dataadapter.Fill(ds1);4041 ReorderList reorderlist =new ReorderList();42 reorderlist.ID ="RL1";43 reorderlist.AllowReorder =true;44 reorderlist.PostBackOnReorder =true;45 reorderlist.EnableViewState =false;46 reorderlist.ShowInsertItem =false;47 reorderlist.ItemTemplate =new pagereorderitemtemplate();48 reorderlist.ReorderTemplate =new pagereorderreorderitemtemplate();49 reorderlist.DragHandleTemplate =new pagereorderhandletemplate();50 reorderlist.EmptyListTemplate =new pagereorderemptytemplate();51 reorderlist.DataKeyField ="SurveyPageID";52 reorderlist.SortOrderField ="SurveyPageNumber";53 reorderlist.ShowInsertItem =false;5455 reorderlist.DataSource = ds1;56 reorderlist.DataBind();575859 contentholder.Controls.Add(reorderlist);60 }6162void reorderlist_UpdateCommand(object sender, ReorderListCommandEventArgs e)63 {64throw new Exception("The method or operation is not implemented.");65 }6667private class pagereorderitemtemplate : ITemplate68 {69public void InstantiateIn(System.Web.UI.Control container)70 {71 Literal lc =new Literal();72 lc.DataBinding +=new EventHandler(lc_DataBinding);73 container.Controls.Add(lc);74 }7576void lc_DataBinding(object sender, EventArgs e)77 {78 Literal lc;79 lc = (Literal)sender;80 ReorderListItem item = (ReorderListItem)lc.NamingContainer;81string dataitem = DataBinder.Eval(item.DataItem,"SurveyPageTitle").ToString();82 lc.Text = dataitem;83 }84 }8586private class pagereorderreorderitemtemplate : ITemplate87 {88public void InstantiateIn(System.Web.UI.Control container)89 {90 Literal lc =new Literal();91 lc.Text ="test2";92 container.Controls.Add(lc);93 }94 }9596private class pagereorderhandletemplate : ITemplate97 {98public void InstantiateIn(System.Web.UI.Control container)99 {100 Literal lc =new Literal();101 lc.Text ="| |";102 container.Controls.Add(lc);103 }104 }105106private class pagereorderemptytemplate : ITemplate107 {108public void InstantiateIn(System.Web.UI.Control container)109 {110 Literal lc =new Literal();111 lc.Text ="empty";112 container.Controls.Add(lc);113 }114 }115}

--end code--

I know most of the templates don't contain all that they should, I just wanted to put something in them so they at least existed. If anyone has any suggestions on how I can get around this error, I would greatly appreciate it.

-madrak

I have been able to pin down the error a little further. The reorderlist works with an sqldatasource that is created in the .aspx page using the following code

1"SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:GLISurveyGenerator_3 %>"2 SelectCommand="SELECT [SurveyPageID], [SurveyPageTitle], [SurveyPageNumber] FROM [tblSurveyPages] WHERE ([SurveyID] = @.SurveyID) order by [SurveyPageNumber]" UpdateCommand="Update [tblSurveyPages] set [SurveyPageNumber] = @.SurveyPageNumber, [SurveyPageTitle] = @.SurveyPageTitle where [SurveyPageID] = @.SurveyPageID">34 "1" Name="SurveyID" Type="Int32">567 "SurveyPageID" Type="Int32">8 "SurvePageTitle" Type="Int32">9 "SurveyPageNumber" Type="Int32">1011

but does not work with the sqldatasource as created in the prior post, anyone have any ideas?


Hi,

I removed reorderlist.DataBind(); and add page.DataBind();. Now I am able to display the data, but unable to reorder the items in the list

- narendra


Hi,

I have the same problem :(

Have anyone solved it?

trouble finding a sample using usercontrols and updatepanels

Hi all,

We have created a menu system primairy based on inserting usercontrols inside one single designed page with several areas's. This works very nice for our sites. Of coarse postback occurs on every click or change.

Some functionality inside usercontrols do a lot of postback, so I would be nice to use the update panel for this type of change.

When trying to implement this I ran into all sorts of trouble, so my first step is to hit this forum. From what i find i'm not the only one having some trouble using usercontrols in combination with the update panel.

So question: Does anyone have a working sample which i could have a look at. Probably can't use it 1 on 1 but well it would a nice starting point.

thanks,

-- jan willem

ps. Does anyone notice .. that all the the ajax stuff (including of coarse atlas) looks REAL nice but when u start to implement it it does realy really takes a lot of time learning to program again :-) Well it's new (ehh well kinda), better and customers do love it.

I wrote a sample to have a test with Ajax and User Control.

http://www.box.net/public/static/q4ltbl5an9.zip

It's simple and straight forward:

1. One user control is linkbutton group, auto generated during runtime;

2. Another user control is to display information according to the user control above;

3. Event subscription is used for information delivery.

4. The link which clicked should be set into different style.

Hope it's helpful.

This was researched days before, now I'm running into the problem of Atlas in live.com. It seems doesn't work with EFP at all!


Thanks for the sample it is usefull!

The only trouble is that the atlas controls (scriptmanager, updatepanel) are still created in the page and not in the usercontrol.

I've created a very simplistic sample of what i'm looking for. Just a page and a usercontrol. I put them in the link below.

http://www.bataviagroep.nl/sampleAtlasUC.zip

- default.aspx --> no atlas, just page and usercontrol doing what it should do .. handling click
- atlas-page.aspx --> same as above, all in one page using atlas and working fine (i added the picture so it's very clear that only the notfication changes

- default-atlas.apsx (same as the first default.aspx) but with the atlas inserted in the usercontrol. This one throws the following exeption:

"The UpdatePanel 'UpdatePanel1' was not present when the page's InitComplete event was raised. This is usually caused when an UpdatePanel is placed inside a template."

For those who don't like downloading stuff from a different server:

default.aspx
<body>
<formid="form1"runat="server">
<div>
<asp:PanelID="panel1"runat="server"/>
</div>
</form>
</body
code behind:
ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

panel1.Controls.Add(Page.LoadControl("~/uc-atlas.ascx"))

EndSub

The usercontrol uc.ascx
<asp:LinkButtonID="LinkButton1"runat="server">click A</asp:LinkButton>
<asp:LinkButtonID="LinkButton2"runat="server">click B</asp:LinkButton>
<br/><br/>
<asp:LabelID="Label1"runat="server"Text="Label">not clicked</asp:Label
code behind:

ProtectedSub LinkButton1_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles LinkButton1.Click

Label1.Text ="clicked A"

EndSubProtectedSub LinkButton2_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles LinkButton2.Click

Label1.Text =

"clicked B"EndSub

The same user control but then with atlas stuff added:

<atlas:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true">

</atlas:ScriptManager>

<asp:LinkButtonID="LinkButton1"runat="server">click A</asp:LinkButton>

|

<

asp:LinkButtonID="LinkButton2"runat="server">click B</asp:LinkButton>

<

br/>

<

br/>

<

atlas:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><asp:LabelID="Label1"runat="server"Text="Label">not clicked</asp:Label></ContentTemplate><Triggers><atlas:ControlEventTriggerControlID="LinkButton1"EventName="Click"/><atlas:ControlEventTriggerControlID="LinkButton2"EventName="Click"/></Triggers>

</

atlas:UpdatePanel>

code behind is the same as above.

--> the above doesn't work and throws an expection.

I would love a sample or idea how to fix this

thanks,

-- jan willem

ps. all the code is in the zipfile


load the custom user control in the Page_Init event, it will work then

wow that worked ...

great that was th easy asnwer i kept missing thanks!

--jw


You might try putting a Placeholder control inside the content template of the UpdatePanel, use FindControl() on the UpdatePanel to locate the Placeholder, and use Placeholder.Controls.Add() to add your dynamically created user control from LoadControl().

The key here is that the container for the user control must exist before OnInit(), and the only way to accomplish this is the declaratively put something there first.

I have gotten this scenario to work. Adding anything directly to the UpdatePanel after OnInitComplete() will not work.

Trouble getting AJAX Extension 1.0 to work in VWD

I have installed the ASP.NET 2.0 AJAX Extension 1.0 on my computer. I tried creating an AJAX enabled web application in Visual Web Developer and the UpdatePanel controls along with all the other new AJAX keywords were not recognised even though the toolbox had been updated with the controls. I thought it might be my errors in the code, so I downloaded the sample code for the ToDo list application tutorial onwww.asp.net/ajax and I had the same problem.

That way I can be sure that it is my computer! I have Microsoft .NET Framework 1.0, 1.1, 2.0 and 3.0 installed. I have tried a reinstall of AJAX Extension 1.0 and have made sure that I have selected 'AJAX Enabled project' at the start up screen.

What is the problem?

Check out this link

http://asp.net/AJAX/Control-Toolkit/Live/Walkthrough/Setup.aspx



Sorry but that really wasn't that helpful! I just have the AJAX Extensions 1.0 NOT The Control Toolkit. I can't get the first bit to work so I can't use the toolkit anyway! When I tried installing the vsi file for the toolkit it didn't install the components properly.

What is the problem?


I think because you r using VWD, you will not be able to install vsi template.

and to use Microsoft AJAX Control you will have to download the toolkit

After downloading the toolkit just follow steps from above link

in "Configure Visual Studio 2005 and Visual Web Developer" section

I hope it helps.


I realised the problem.

I needed to install Service Pack 1 for VWD before it would fully recognise the AJAX Extensions. That solved it and I could then install the control toolkit

Trouble getting started with drag/drop -- JS Error

Hi,

I am new to Atlas and am working my way through some tutorials. I am trying to use some hover/popup behaviors that rely on the AtlasUIDragDrop script. However, when I try to load it up I get a JS error. I've got a bunch of other atlas controls on the same page, and they all work, so I'm not sure what's wrong.

Here's what I have:

<atlas:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<atlas:ScriptReference ScriptName="AtlasUIDragDrop" />
</Scripts>
</atlas:ScriptManager>
...
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<references>
<add src="http://pics.10026.com/?src=ScriptLibrary/Atlas/Release/AtlasUIDragDrop.js" />
</references>
<components>
...

When I load up my page, I get the following JS error:

"Web is not defined. AtlasUIDragDrop.js (line 6)"

Thanks in advance for any help!

-Nick
Hi,

check your code because the Web namespace has been renamed to Sys.
Thanks - that did the trick.

Nick

Trouble getting started, please help

Ok my problem is that I can't get a basic update panel to function correctly.

Here is what I did:

1) Downloaded and installed ASP.NET AJAX

2) Added a reference to System.Web.Extensions from myexisting ASP.NET application.

3) Copied all the web.config stuff I could find into my own web.config. I can post every web.config change if needed.

4) Created a new form.

5) Added a script manager, an update panel, a button and 2 labels.

6) I put 1 label into the update panel

7) I added an update panel trigger for an asyncpostbacktrigger for Button1 / Click.

8) I put some code in the page load and button click events to write out the current time to the labels.

Now when I run this, the button click doesn't just update the update panel, it does a full postback and page reload.

I tried creating an application from the start using the ajax template, and this exact same code works fine, but I seem unable to ADD the ajax functionality into my existing application.

Any ideas? Any way to narrow down the problem?

Here is the page output from my test page (the one the doesn't work):

<!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><title>Untitled Page</title></head><body> <form name="form1" method="post" action="zajax.aspx" id="form1"><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTE4MDcxODkwD2QWAgIDD2QWBAIBDw8WAh4EVGV4dAUKNjozMzozNSBQTWRkAgcPZBYCZg9kFgICAQ8PFgIfAAUKNjozMzozNSBQTWRkZCbSNxjGnv0oo3s0JvUpWd1OHCwj" /><script src="/ScriptResource.axd?d=WWzAfBI_rdQxam3uQdNeBo6UjgPObu2SaxGwCsecklai8gu7WtIhUsofOWAHTAlPUibAvbb2N8dnhGH5Tlo9L6EdZbxe5NvYcX9AZQ-T0Do1&t=633058483670203504" type="text/javascript"></script> <div>  <span id="Label2">6:33:35 PM</span> <input type="submit" name="Button1" value="Button" id="Button1" />   <div id="UpdatePanel1"> <span id="Label1">6:33:35 PM</span> </div> </div> <script type="text/javascript"><!--Sys.Application.initialize();// --></script></form></body></html>

Now when I put the same server side code into an AJAX Template Application, it DOES work, and the page output contains a lot more stuff:

<!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><title>Untitled Page</title></head><body> <form name="form1" method="post" action="default2.aspx" id="form1"><div><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTE4MDcxODkwD2QWAgIDD2QWAgIBDw8WAh4EVGV4dAUKNjozNToyNCBQTWRkZNZhuPWbMGlct/IbEepy3VFq4PPN" /></div><script type="text/javascript"><!--var theForm = document.forms['form1'];if (!theForm) { theForm = document.form1;}function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); }}// --></script><script src="/WebResource.axd?d=IGbOu8tbXSYcXb22j2-mVA2&t=632993516188917664" type="text/javascript"></script><script src="/ScriptResource.axd?d=qjtDxogNeiSUKOtmty-j9LOFc00mMzNwj-wep6XL5baMU0VZUYW2HyaCCOXHOI2_3oSO_YCxqyX9CyTLuDTKeyhteOcDGwPlwaJ4N4EDBr41&t=633058483670203504" type="text/javascript"></script><script src="/ScriptResource.axd?d=qjtDxogNeiSUKOtmty-j9LOFc00mMzNwj-wep6XL5baMU0VZUYW2HyaCCOXHOI2_3oSO_YCxqyX9CyTLuDTKe9Vuooudj_iJ62Khwrpdqfc1&t=633058483670203504" type="text/javascript"></script>  <span id="Label2">6:35:24 PM</span> <input type="submit" name="Button1" value="Button" id="Button1" /> <script type="text/javascript">//<![CDATA[Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], ['Button1'], [], 90);//]]></script>   <div id="UpdatePanel1"> <span id="Label1">Label</span> </div> <div><input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLAh/rhCAKM54rGBo/RxSYDefM+QwfmqDXaIMTc/6Ya" /></div><script type="text/javascript"><!--Sys.Application.initialize();// --></script></form></body></html>

My ASPX page has this:

<%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false" CodeBehind="zAjax.aspx.vb" Inherits=".zAjax" %><!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 id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server">  <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>   <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /> </Triggers> </asp:UpdatePanel> </form></body></html>

Seems like you are messed up with the web.config file. Take a new AJAX Project and copy the web.config file to replace your existing web.config. If you have made any custom changes to your original web.config file, make them in the new.

Are you adding any AJAX related dll's to the \bin folder? You dont need to add them coz with ASP.NET AJAX 1.0 all the assemblies are installed into GAC.

Thanks


You might also find this handy...I know I did when I found the whole thing was reloading/rebuilding (dynamic controls etc)...it should allow you to establish the type of postback you are getting...

' asynchronous postback?
If MyScriptManager.IsInAsyncPostBack =FalseThen' do some stuffEndIf

Trouble getting Value out of DynamicPopulate Populated Control

Hi:

I'm using a combination of AutoComplete and DynamicPopulate out of the AJAX Toolkit. The AutoComplete polls my Active Directory, then sends the selected name to the DynamicPopulate control. The DP control then sends me back an email address. Since the DP control will not populate a textbox's "Text" value, I decided to use a label. The label populates properly on the page, however, when I try to pull the value through my code, the label's text value is "". All population using the DP is done before the call for the values. Does anyone have any suggestions?

The label is being populated after the page loads; ASP.NET is a server side language, since the page hasnt posted back to the server yet, your code still thinks the value is empty.

Thanks for your reply. I understand why I can't get the value out, and I'm trying to prevent a postback, however, is there any possible other way to get these values out? I've tried a javascript "hacky" way to get the value into an HTML control, then finding the control to get it's value, but that's proving to be quite a feat in itself. Any suggestions?

Here's the set up:

I have a web service with two methods. One goes to my Active Directory and does AutoComplete on the name. Onblur, it calls the other method which takes the text in the AutoComplete text box and sends it back through the directory, which then returns the email address. A DynamicPopulate control populates a label (which is going to be hidden) in order for me to grab the email address. My structure is lenient, so any suggestions would be greatly appreciated!

Thanks

John


I'm having somewhat the same problem!

I use the DynamicPopulateextender to populate at Panel with information from a webservice. It works just fine but now i want to fetch the info and save it. If u get it to work, please tell me :)

Trouble installing Control Toolkit

Hi all, I cannot install the toolkit properly. Is there a specific location that I should extract the files to? I get error messages saying that certain files (website examples etc.) didn't install properly. Thanks for your help.

Andy

Hi MonkeyInquisition,

monkeyinquisition:

Is there a specific location that I should extract the files to?

As far as I know, there's no specific location limited. But it is recommended to extract the files to System Driver(c):\Program Files\Microsoft ASP.NET.

To install the Ajax Control Toolkit, you'd better have a glance at this: http://www.asp.net/ajax/control-toolkit/live/Walkthrough/Setup.aspx. Also, there's a pretty good video tutorial provide on this url: http://www.asp.net/learn/ajax-videos/.

By the way, Ajax Control Toolkit works depend on Asp.net 2.0 Ajax Extensions, so you should install it first. It's video tutorial is also provided on the url above.Thanks

I hope this help.

Best regards,

Jonathan

Trouble installing ASP.NET Ajax

I have tried several times to install ASP.NET Ajax (latest version as of November 9, 2006). I get no indications of installation failure. However, the Ajax project template available when I create a project. There is no evidence of a project template in the appropriate templates folder.

I would like to use ASP.NET Ajax in my current project but will not be able if I can't get it installed. Is this a bug or am I doing something wrong?

One thing I did notice is the extensions file is AJAXExtensionsToolbox.dll (notice the plural Exensions, but the documentation refers to Extension singular.

Thanks,

Rod

Hi Rod,

I was wondering whether you managed to solve the above problem.

I'm having a similar problem trying to install asp.net AJAX extensions and have the relevant templates appear in microsoft visual web developer express.

Would love to know in case you found a solution to this issue.

Thanks!!

Einat Schlagmann


For what it's worth, my first attempt to install moments ago, failed after about 5 minutes of disk churning.

I noticed I was running Visual Studio was running, so I shut that down and reinstalled. Then it worked, installed ok and controls are available.

I also noticed though that the "UpdatePanel" control (which allows for "partial page" updates does not allow drag and drop - which it should). Apparently it works in the Beta, which MS uses in the Video, but not in the "final release". You can actually make controls "children" of the updatepanel control using the HTML (source) view but that is tedious and it is not reflected in the "Design mode". I hope I am wrong about this but that's my experience thus far (trying it today).

Just my experience. Good Luck.


hello.

well, it's working on my machine, but i'm using vs 2008...

Trouble installing Ajax Control Toolkit

Hi all, I've not managed to install the toolkit properly. Is there a specific folder that I should extract the files to? Thanks.

Andy

I am not sure what exactly the problem is but any how ...You might havn't installed the prerequisites as well.

You need to install Extensions package as well. from the same donwload page.......

Then there is dll file in the bin folder where you installed the setup you can use it in your pages then easily...

Regards

Muhammad Tabish Sarwar


Hi,

I'd like to add something to Muhammad's post.

To use it, just place the AjaxControlToolkit.dll assembly in the bin folder of you web site.

Trouble Retaining values entered or selected for controls inside an update panel

Hi,

Trouble in retaining values of dropdownlist, textboxes, and other controls when dropdownlist selectedindexchanged event is triggered, the controls are inside a user
control and this user control inside a parent user control with an update panel. Can you guys help me hwo to retain the values. I have set EnableViewState to true. Where
is correct page event to store entered and selected values before the values on controls are re-intialized. Please provide some codes and please eb specific unto which is best to use (Session variables, hiddenfields or others). Thanks in advanced.

den2005

Can you please actually provide code you are using and getting the issue with. Otherwise here are some links:

http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx


Hi jodywbcb,

I am working on 5 dropdownlist controls (these codes are created by a co-worker) and they are some how interdependent, first dropdown and second dropdown and third dropdown determines the data for fourth and fifth dropdown, now second dropdown determines the data for third dropdown. The thing is if the first dropdown is set to item 2, and second dropdown is set to to item2 and data selected on third dropdown remains set after postback.

Here at some data I am working on...So what mistake I have made..

protected override void OnLoad(EventArgs e){...this.UpdateContent();base.OnLoad(e);if (multiView.GetActiveView().ID =="viewInputForm"){if (Session["id"] !=null)ShowAssessmentDetails(Session["id"].ToString());DisplayProcessedIconImage();}}//All Dropdown SelectedIndexChanged Eventprotected void DropDown_SelectedIndexChanged(object sender, EventArgs e){if (sender ==this.ddlEmployee){...}else if (sender ==this.ddlCategory){FillSubCategoryList();FillCompetencyList();}else if (sender ==this.ddlSubCategory){if (ddlSubCategory.SelectedIndex != 0){int subcat = Int32.Parse(ddlSubCategory.SelectedValue);ddlCategory.SelectedValue = oAssessment.GetCategoryID(subcat);FillSubCategoryList();ddlSubCategory.SelectedValue = subcat.ToString();if (subcat.ToString() !=string.Empty && subcat.ToString() !="0")ViewState["ddlSubCategory"] = subcat.ToString();}FillCompetencyList();}else if (sender ==this.ddlCompetencyCode){UpdateCompetencyList(1);DoCourseCodeMatching();}else if (sender ==this.ddlCompetency){UpdateCompetencyList(2);DoCourseCodeMatching();}else if (sender ==this.ddlCourseCode){ClearSuggestedTrainingData();//FillTrainingData();DoCourseCodeMatching();}else if (sender ==this.ddlYear){...}else if (sender ==this.ddlCompetencyModel){FillCategoryList();FillSubCategoryList();FillCompetencyList();}...}private void ShowAssessmentDetails(string idVal){oAssessment.ID = Convert.ToInt32(idVal);if (oAssessment.Get()){InitializeControls();...FillCompetencyModelList();//First Dropdown...FillEmployeeData();try { ddlCompetencyModel.SelectedValue = oAssessment.CompetencyModelID.ToString(); }catch { ddlCompetencyModel.SelectedIndex = 0; }FillCategoryList();//Second DropDownFillSubCategoryList();//Third DropdownFillCompetencyList();//Fourth DropdownFillCourseCode();ddlCompetency.SelectedValue = oAssessment.CompetencyID.ToString();UpdateCompetencyList(2);try { ddlCourseCode.SelectedValue = oAssessment.CatalogueCourseID.ToString(); }catch { ddlCourseCode.SelectedIndex = 0; }...FillSupervisorApproval(cbTrainingRequest.Checked);FillLocalApproval(cbTrainingRequest.Checked);ddlCSApproval.SelectedValue = oAssessment.CompetencySupervisorApprovalID.ToString();ddlCLApproval.SelectedValue = oAssessment.CompetencyLocalApprovalID.ToString();...try { ddlSuggLocalTrainingType.SelectedValue = oAssessment.SuggestedLocalTrainingType.ToString(); }catch { ddlSuggLocalTrainingType.SelectedIndex = 0; }tbLocalTrainingSuggest.Text = oAssessment.SuggestedLocalTraining;try{ddlSuggTrainingType.SelectedValue = oAssessment.SuggestedTrainingType.ToString();tbSuggestedTraining.Text = oAssessment.SuggestedTraining;}catch{ddlSuggTrainingType.SelectedIndex = 0;tbSuggestedTraining.Text = String.Empty;}...}}private void InitializeControls(){...FillCompetencyModelList();...FillCategoryList();FillSubCategoryList();FillCompetencyList();FillSupervisorApproval(false);FillLocalApproval(false);...FillCourseCode();...}private void FillCompetencyModelList(){try{using (DataAccessLayer objDAL =new DataAccessLayer("CompetencyModel_GetAllByYear")){objDAL.AddParameter("Year", ddlYear.SelectedValue);objDAL.ExecuteReader();ddlCompetencyModel.Items.Clear();ddlCompetencyModel.Items.Add(new ListItem("-- select model --","0"));while (objDAL.DataReader.Read()){ddlCompetencyModel.Items.Add(new ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyModelID"])));}}}catch{ddlCompetencyModel.Items.Clear();ddlCompetencyModel.Items.Add(new ListItem("-- select model --","0"));}}private void FillCompetencyList(){if (ddlCompetencyModel.SelectedIndex != 0){try{ddlCompetencyCode.Items.Clear();ddlCompetency.Items.Clear();ddlCompetencyCode.Items.Add(new ListItem("-- select code --","0"));ddlCompetency.Items.Add(new ListItem("-- select competency --","0"));if (ddlCompetencyModel.SelectedIndex == 0){if ((ddlSubCategory.SelectedValue !=null) && (ddlSubCategory.SelectedValue !="0")){using (DataAccessLayer objDAL =new DataAccessLayer("Competency_GetBySubCategoryIDAndYear")){SqlParameter sqlparam =new SqlParameter("@.subcat", SqlDbType.Int);sqlparam.Value = ddlSubCategory.SelectedValue;objDAL.AddParameter(sqlparam);objDAL.AddParameter("year", ddlYear.SelectedValue);objDAL.ExecuteReader();while (objDAL.DataReader.Read()){ddlCompetencyCode.Items.Add(new ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]), Convert.ToString(objDAL.DataReader["CompetencyID"])));ddlCompetency.Items.Add(new ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));}}}else if ((ddlCategory.SelectedValue !=null) && (ddlCategory.SelectedValue !="0")){using (DataAccessLayer objDAL =new DataAccessLayer("Competency_GetByCategoryIDAndYear")){SqlParameter sqlparam =new SqlParameter("@.catid", SqlDbType.Int);sqlparam.Value = ddlCategory.SelectedValue;objDAL.AddParameter(sqlparam);objDAL.AddParameter("year", ddlYear.SelectedValue);objDAL.ExecuteReader();while (objDAL.DataReader.Read()){ddlCompetencyCode.Items.Add(new ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]), Convert.ToString(objDAL.DataReader["CompetencyID"])));ddlCompetency.Items.Add(new ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));}}}else{using (DataAccessLayer objDAL =new DataAccessLayer("Competency_GetAllByYear")){objDAL.AddParameter("year", ddlYear.SelectedValue);objDAL.ExecuteReader();while (objDAL.DataReader.Read()){ddlCompetencyCode.Items.Add(new ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]), Convert.ToString(objDAL.DataReader["CompetencyID"])));ddlCompetency.Items.Add(new ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));}}}}else if (ddlCompetencyModel.SelectedIndex > 0){if ((ddlSubCategory.SelectedValue !=null) && (ddlSubCategory.SelectedValue !="0")){using (DataAccessLayer objDAL =new DataAccessLayer("Competency_GetBySubCatIDModelYear")){SqlParameter sqlparam =new SqlParameter("@.subcat", SqlDbType.Int);sqlparam.Value = ddlSubCategory.SelectedValue;objDAL.AddParameter(sqlparam);objDAL.AddParameter("year", ddlYear.SelectedValue);sqlparam =new SqlParameter("@.compmodelid", SqlDbType.Int);sqlparam.Value = ddlCompetencyModel.SelectedValue;objDAL.AddParameter(sqlparam);objDAL.ExecuteReader();while (objDAL.DataReader.Read()){ddlCompetencyCode.Items.Add(new ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]), Convert.ToString(objDAL.DataReader["CompetencyID"])));ddlCompetency.Items.Add(new ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));}}}else if ((ddlCategory.SelectedValue !=null) && (ddlCategory.SelectedValue !="0")){using (DataAccessLayer objDAL =new DataAccessLayer("Competency_GetByCatIDModelYear")){SqlParameter sqlparam =new SqlParameter("@.catid", SqlDbType.Int);sqlparam.Value = ddlCategory.SelectedValue;objDAL.AddParameter(sqlparam);objDAL.AddParameter("year", ddlYear.SelectedValue);sqlparam =new SqlParameter("@.compmodelid", SqlDbType.Int);sqlparam.Value = ddlCompetencyModel.SelectedValue;objDAL.AddParameter(sqlparam);objDAL.ExecuteReader();while (objDAL.DataReader.Read()){ddlCompetencyCode.Items.Add(new ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]), Convert.ToString(objDAL.DataReader["CompetencyID"])));ddlCompetency.Items.Add(new ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));}}}else{using (DataAccessLayer objDAL =new DataAccessLayer("Competency_GetAllByModelYear")){objDAL.AddParameter("year", ddlYear.SelectedValue);SqlParameter sqlparam =new SqlParameter("@.compmodelid", SqlDbType.Int);sqlparam.Value = ddlCompetencyModel.SelectedValue;objDAL.AddParameter(sqlparam);objDAL.ExecuteReader();while (objDAL.DataReader.Read()){ddlCompetencyCode.Items.Add(new ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]), Convert.ToString(objDAL.DataReader["CompetencyID"])));ddlCompetency.Items.Add(new ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));}}}}}catch{ddlCompetencyCode.Items.Clear();ddlCompetency.Items.Clear();ddlCompetencyCode.Items.Add(new ListItem("-- select code --","0"));ddlCompetency.Items.Add(new ListItem("-- select competency --","0"));}}else{ddlCompetencyCode.Items.Clear();ddlCompetency.Items.Clear();ddlCompetencyCode.Items.Add(new ListItem("-- select code --","0"));ddlCompetency.Items.Add(new ListItem("-- select competency --","0"));}}private void FillSubCategoryList(){try{if ((ddlCategory.SelectedValue !=null) && (ddlCategory.SelectedValue !="0")){using (DataAccessLayer objDAL =new DataAccessLayer("CompetencySubCategory_GetByCategoryID")){SqlParameter sqlparam =new SqlParameter("@.CatID", SqlDbType.Int);sqlparam.Value = ddlCategory.SelectedValue;objDAL.AddParameter(sqlparam);objDAL.ExecuteReader();ddlSubCategory.Items.Clear();ddlSubCategory.Items.Add(new ListItem("-- select subcategory --","0"));if (ddlCompetencyModel.SelectedIndex != 0){while (objDAL.DataReader.Read()){ddlSubCategory.Items.Add(new ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencySubCategoryID"])));}}}}else{using (DataAccessLayer objDAL =new DataAccessLayer("CompetencySubCategory_GetAll")){objDAL.ExecuteReader();ddlSubCategory.Items.Clear();ddlSubCategory.Items.Add(new ListItem("-- select subcategory --","0"));if (ddlCompetencyModel.SelectedIndex != 0){while (objDAL.DataReader.Read()){ddlSubCategory.Items.Add(new ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencySubCategoryID"])));}}}}// Even with/without these codes below still the sameif (ViewState["ddlSubCategory"] !=null && ddlSubCategory.Items.Count > 1){ddlSubCategory.SelectedValue = ViewState["ddlSubCategory"].ToString();ddlSubCategory.SelectedIndex = ddlSubCategory.Items.IndexOf(ddlSubCategory.Items.FindByValue(ViewState["ddlSubCategory"].ToString()));}}catch{ddlSubCategory.Items.Clear();}}


The first thing that comes to mind is your InitializeControls() method...

I see alot of "..." so not sure what that is comenting out...and probably irrelevant

However:

I would do this:

private void InitializeControls()
{
...

If (!Page.IsPostback)

{
FillCompetencyModelList();
...
FillCategoryList();
FillSubCategoryList();
FillCompetencyList();
FillSupervisorApproval(false);
FillLocalApproval(false);
...
FillCourseCode();

}
...
}

It appears you are always re-initializing your data which is not necessary...and may be always setting all of your databound controls to the initial page load values...

However your viewstate issue - you are never actually setting any viewstate values so:

// Even with/without these codes below still the same
if (ViewState["ddlSubCategory"] !=null && ddlSubCategory.Items.Count > 1)
{
ddlSubCategory.SelectedValue = ViewState["ddlSubCategory"].ToString();
ddlSubCategory.SelectedIndex = ddlSubCategory.Items.IndexOf(ddlSubCategory.Items.FindByValue(ViewState["ddlSubCategory"].ToString()));

}

1. You do not need to set the ddlSubCategory.Selected Value and SelectedIndex both at the same time...

2. Do not use the Viewstate of the control to try and re-select the controls select item - it may work but the whole point of the Events when the ddl is selectedindex changed is to already give you that value (in otherwords it is already selected)...in other words that code is not warranted or needed and nor will it ever actually do anything...

now if you were selecting a value in the ddlSubCategory based on say ddlSubCategory_Other then you would do this:

ddlSubCategory.SelectedValue = ddlSubCategory_Other.SelectedValue (if they matched values wise otherwise you would have to loop through the items and determine what should be selected..based on whatever matching criteria you have.)

Suggestions:

Do not reference viewstate for your selected index or values and definately do not try to use both SelectedIndex and SelectedValue...

Code Sample:

For instance here is a simple DDL that populates a string with a mode name:

modeName = dropFilterBy.SelectedValue.ToString();

{do something with it}

Now if I want to keep the modeName in viewstate this is what I would do...

publicstring modeName

{

get

{

return (string)ViewState["modeName"] !=null ?

(

string)ViewState["modeName"] :"Unknown";

}

set { ViewState["modeName"] =value; }

}

That allows me to use the ModeName in code to reference values and not call the dropFilterBy.SelectedValue.ToString(); for proccessing in other areas of the code where I may need the value...

Again the infinitesloop link I responded with earlier - he has two great series on viewstate and understading controls - easy to read and will shed even more info on how to properly use viewstate....and how the page life cycle all works...


jodywbcb:

The first thing that comes to mind is your InitializeControls() method...

I see alot of "..." so not sure what that is comenting out...and probably irrelevant

I think for this part of problem the values of 5 dropdownlist control they are irrelevant, because they are for other sections of the user control.

jodywbcb:

However:

I would do this:

private void InitializeControls()
{
...

If (!Page.IsPostback)

{
FillCompetencyModelList();
...
FillCategoryList();
FillSubCategoryList();
FillCompetencyList();
FillSupervisorApproval(false);
FillLocalApproval(false);
...
FillCourseCode();

}
...
}

It does not work, the data is still not retain, no change in situation

jodywbcb:

It appears you are always re-initializing your data which is not necessary...and may be always setting all of your databound controls to the initial page load values...

Hmmm...the child user control is inside an update panel control(Atlas control) of the parent user control, if I do not repopulate the data then after postback there will be no data.

jodywbcb:

However your viewstate issue - you are never actually setting any viewstate values so:

// Even with/without these codes below still the same
if (ViewState["ddlSubCategory"] !=null && ddlSubCategory.Items.Count > 1)
{
ddlSubCategory.SelectedValue = ViewState["ddlSubCategory"].ToString();
ddlSubCategory.SelectedIndex = ddlSubCategory.Items.IndexOf(ddlSubCategory.Items.FindByValue(ViewState["ddlSubCategory"].ToString()));

}

1. You do not need to set the ddlSubCategory.Selected Value and SelectedIndex both at the same time...

2. Do not use the Viewstate of the control to try and re-select the controls select item - it may work but the whole point of the Events when the ddl is selectedindex changed is to already give you that value (in otherwords it is already selected)...in other words that code is not warranted or needed and nor will it ever actually do anything...

now if you were selecting a value in the ddlSubCategory based on say ddlSubCategory_Other then you would do this:

ddlSubCategory.SelectedValue = ddlSubCategory_Other.SelectedValue (if they matched values wise otherwise you would have to loop through the items and determine what should be selected..based on whatever matching criteria you have.)

Suggestions:

Do not reference viewstate for your selected index or values and definately do not try to use both SelectedIndex and SelectedValue...

Don't follow you here, I just trying both lines of code to solve the problem..no difference.

jodywbcb:

Code Sample:

For instance here is a simple DDL that populates a string with a mode name:

modeName = dropFilterBy.SelectedValue.ToString();

{do something with it}

Now if I want to keep the modeName in viewstate this is what I would do...

publicstring modeName

{

get

{

return (string)ViewState["modeName"] !=null ?

(

string)ViewState["modeName"] :"Unknown";

}

set { ViewState["modeName"] =value; }

}

That allows me to use the ModeName in code to reference values and not call the dropFilterBy.SelectedValue.ToString(); for proccessing in other areas of the code where I may need the value...

Again the infinitesloop link I responded with earlier - he has two great series on viewstate and understading controls - easy to read and will shed even more info on how to properly use viewstate....and how the page life cycle all works...

Don't exactly follow you on this, are you telling not to use viewstate of control but use a ViewState object? Any other ideas?

This part of page appears when a user clicks a button either add/edit "item" link inside a Gridview.

Thanks for the reply..

Dennis


Forgot to add..

CompetencyModel

Category

SubCategory

2 more data

When Category is set to Item2, Item 1 is "-- select a category --", when I change the selected value on SubCategory, the value is retain after postback, but when Category is set to any other values or other dropdown values changes, the values is not being retain..

Please advise for ideas.


Correction previous issues, it seems when Dropdown 1 is set to a default value not item1 and so as Dropdown 2, values are being retain after postback, otherwise no values are retain... So, how do I retain values?

trouble setting focus on a textbox after I put the panel in a updatepanel

My webpage was working fine setting focus properly on a textbox but after I put a few panels in an updatepanel the focus no longer works. I put two panels in the same updatepanel box, each one has a button click that goes and retrives some info. Everythng works fine except focus isnt being set. Im using c# in Visual Studio 2005 professional

how do you handle the focus of the textbox and in what event? usually you can set the focus using $get(textboxClientID) during the pageLoaded event of Sys.WebForms.PageRequestManager

hth


Are you using YourScriptManager.SetFocu(YourControl) ?


ScriptManager.SetFocus($get(textBox.ClietnId))

Let me know if this helpful to you

Trouble trying to use PostbackTrigger with FileUpload in UpdatePanel

Scenario: I have 2 UpdatePanels, 1 containing a GridView (master) and the other containing a DetailsView (child). The DetailsView has an AsyncPostBackTrigger for the GridView's SelectedIndexChanged event. I use a CommandField with ShowEditButton in the DetailsView. The DetailsView is in Edit mode by default. One of the fields in the DetailsView contains a FileUpload. In the ItemCreated event, I register the auto generated "Update" LinkButton as a PostBackControl. I have also tried adding a PostBackTrigger to the UpdatePanel, but neither attempt results in the FileUpload.HasFile property being true.

1Protected Sub dv_ItemCreated(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles dv.ItemCreated2Dim linkAs LinkButton =Nothing3 Dim triggerAs PostBackTrigger =Nothing4 If Not dv.FooterRowIs Nothing Then5 Dim commandRowIndexAs Integer = 06Dim commandRowAs DetailsViewRow = dv.Rows(commandRowIndex)7Dim cellAs DataControlFieldCell =CType(commandRow.Controls(0), DataControlFieldCell)8For Each ctlAs ControlIn cell.Controls9If TypeOf ctlIs LinkButtonThen10 link =CType(ctl, LinkButton)11Else : link =Nothing12 End If13 If Not linkIs Nothing Then14 If link.CommandName.Equals("update", StringComparison.CurrentCultureIgnoreCase)Then15'trigger = New PostBackTrigger16 'trigger.ControlID = link.ClientID17 'upDV.Triggers.Add(trigger)18 ScriptManager.GetCurrent(Me).RegisterPostBackControl(CType(link, Control))19End If20 End If21 Next22 End If23 End Sub
The page does do a full postback when the Update button is hit, so at least that works. I'm assuming that HasFile is false for the first Update because the Update button is not registered with the ScriptManager when the page is loaded. After an update, page is loaded with the control registered as a PostBackControl, thus making subsequent updates work fine. Assuming that this is correct, is there anyway to do this? My reasoning in this assumption is that if I select a row in the GridView by default such that when the DetailsView is first loaded into the page, it has a record as opposed to the EmptyDataText being shown, everything works as expected. Is there a way to use this functionality without having a record in DetailsView before the user actually selects a record?

Kind of funny that this works at all. The PostBackTrigger is supposedly not capable of being added programatically based onthe docs.

Ryan Pedersen
MCP


According to the documentation for AJAX the FileUpload control is not supported.

There are several work around available on this forum.

Trouble using AJAX UpdatePanel with Small Business Starter Kit

Has anyone else had trouble using AJAX 1.0 for ASP.NET 2.0 with the Small Business Starter Kit? I have put a grid control inside an UpdatePanel and when I click the column headers to sort the grid I get a full page refresh and a JavaScript error.

The Fish.

Check out thislist of common problems and solutions

-Damien


Hi,

Thanks for your post.

But how should we solve it if you don't privide any useful information scuh as code or error message?

Regards,

Trouble Using ValidatorCallout in Table

I am having trouble using a validatorcallout for a control located inside a table. The validatorcallout works; however, I can see the text

located behind the validatorcallout. See the image below.

Validator Callout

The text that appears behind the validatorcallout is a ASP label with text. Has anyone else had the problem? Is there a solution ?

Hi,

First, you can try to set the label's z-index to a lower value. For instance:
<style type="text/css">
.lb
{
z-index : -5;
}
</style>
<asp:Label ID="Label1" runat="server" Text="Label" CssClass="lb"></asp:Label>

Please refer to this thread: http://forums.asp.net/t/1123354.aspx if it doesn't work.


SmileThanks. Your solution works in IE. Howeverin a Mozilla browser the label disappears completely. I looked at the otherfixes you suggested, but I am little confused on how to implementthem. Any additional suggestions would greatlyappreciated.

Trouble w/ Atlas and Custom User Control

I am trying to create a simple user control that shows a hidden div when an imagebutton is clicked. It works perfectly in a regular page, but in a user control it is conventionally posting back rather than refreshing via Atlas. I have an <atlas:ScriptManager> tag in the page for the control. Below is my code for the control:

<%@dotnet.itags.org. Control Language="C#" AutoEventWireup="true" CodeFile="RatingsBar.ascx.cs" Inherits="UserControls_RatingsBar" %>
<asp:ImageButton ID="showBarGraphButton" runat="server" ImageUrl="~/_Images/bargraph.gif"
OnClick="showBarGraphButton_Click" />

<atlas:UpdatePanel ID="updatePanel1" runat="server" RenderMode="Inline">
<Triggers>
<atlas:ControlEventTrigger ControlID="showBarGraphButton" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Panel ID="barGraphPopup" CssClass="popupHide" runat="server">
<asp:Image ID="sampleImage" runat="server" ImageUrl="~/_Images/barGraphExample.gif"/>
</asp:Panel>
</ContentTemplate>
</atlas:UpdatePanel>

Below is my code for the default.aspx page:
<%@dotnet.itags.org. Page Title="Hi There" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"Inherits="_Default" %><%@dotnet.itags.org. Register TagPrefix="uc" TagName="Karmevent" Src="~/_UserControls/Karmevent.ascx" %><%@dotnet.itags.org. Register TagName="RatingsBar" TagPrefix="uc" Src="~/_UserControls/RatingsBar.ascx" %><!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 href="_Stylesheets/StyleSheet.css" rel="stylesheet" type="text/css" /><atlas:ScriptManager ID="ScriptManager" runat="server" /></head><body><form id="form1" runat="server"><uc:RatingsBar ID="rb1" runat="server" /></form></body></html>
Nevermind, everyone. I re-did the code from scratch and it works. I still have no idea what I did wrong, but it's working now.

Trouble when using UpdatePanel between <tr> tags

Hello,

It seems I'm getting trouble when trying to use an updatepanel between a set of <tr> tags:

<table>
<tr>
<atlas:UpdatePanel ID="UpdatePanel1" runat=server Mode=Conditional>
<ContentTemplate>
<td>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack=true OnCheckedChanged="CheckBox1_CheckedChanged" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><%=DateTime.Now %>
</td>
</ContentTemplate>
</atlas:UpdatePanel>
</tr>
</table>

This causes the whole page to post back, not just the portion of the page.

However , When I try to use <asp:Table> tags , everything works fine:

<asp:Table>
<asp:TableRow>
<atlas:UpdatePanel ID="UpdatePanel2" runat="server" Mode="Conditional">
<ContentTemplate>
<asp:TableCell>
<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged" />
<br />
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label><%=DateTime.Now %>
</asp:TableCell>
</ContentTemplate>
</atlas:UpdatePanel>
</asp:TableRow>
</asp:Table>

Is this a bug, or am I required to use <asp:table> tags instead of regular html tags ?

hello.

that is beacuse your html isn't correct. you'll have to put the updatepanel inside the <td> element.


Luis is correct. The UpdatePanels renders either a <div> or a <span> depending on its RenderMode property. It's not valid XHTML to have these tags inside a <tr> - they have to go inside a <td>.

Thanks,

Eilon


From what I've found they could also wrap the <table> if your table is not that big it might be another option.