Showing posts with label panel. Show all posts
Showing posts with label panel. Show all posts

Wednesday, March 28, 2012

AJAX Bug?

I have a page with an upper UpdatePanel that has 3 collapsible panel's and a lower UpdatePanel that has 2 gridviews in it. What happens is you select a list of employees and different training items in the upper UpdatePanel and a cross-tab grid is displayed in the lower UpdatePanel. Once the data is loaded into the cross-tab, it goes through every cell to update the text data to a graphical view of the data. So instead of 0 you would see a blank checkbox, and instead of 2 you would see a checked checkbox. The gridview columns are created dynamically based on what training selections were made. There can be as many as 400 training items at once and a couple hundred employees as well, so you can imagine how big the cross-tab grid can become if everything is selected. This page worked GREAT before I implemented ajax on it(I have my reasons), but now with AJAX in the page the cross-tab will only show if only a small number of employees or trainig items are selected. If you try to select every training item and every employee the whole program crashes in a very nasty way. Imagine losing the whole IE menu bars and start button, quickstart buttons, etc. The WHOLE screen becomes a jumbled mess. Any suggestions? Is this a bug or am I just trying to access too much data through AJAX?

JavaScript just flat out sucks with large amounts of data when looping.

You are probably causing JavaScript to have to loop through 1000's of form elements to figure out what is selected and build a string of that data to be posted. The freezing is the browser eating your CPU trying to crunch all of that data.

Eric


Thanks for the reply. I am starting to understand that this is the reason. Can you think of any workarounds? The only reason AJAX is being used on the page is to get the browser back button to work correctly so that the user can't click back and have someone's employee trained status revert to the previous state. Is there another way around this? Thanks.
hi.
i'm not sure if you're using updatepanels or are you wroking directly with javascript?
Here is a good post on JavaScript performance recommendations:http://blogs.msdn.com/ie/archive/2006/08/28/728654.aspx
Using Ajax
using Ajax.net with Update Panels.

Ajax Beta V.1: Strange behaviour with treeview inside the update panel (Again!)

I have a treevew control ( with dynamically created nodes) that was working great with July CTP. The control no longer works with beta any more:

1. Does not maintain the expanded state during ajax post back ( the nodes expand collapse unexpectly).

2. Strange behaviour if nodes are dynamically populated. This bug was present with the earlier atlas CTP's but was fixed with July CTP.

I have to use the same work around referenced in post:http://forums.asp.net/thread/1203662.aspx

------------------------

Similar issue, I didn’t want the tree to update always. The workaround that I am using is ,

Put tree in update panel (with conditional update).

- Add "TreeNodePopulate" event as a trigger in your update panel

- Turn off the client behaviour of tree expand ( putPopulateNodesFromClient = false ) and let atlas take care of it.

- Use Populate on demand = true.

-------------------------

Is any body else is having similar problem?

You might want to look at the CSS Adapters Beta 3 - they have what appears to be a 'ajaxified' treeview control that does not do full postbacks and retains viewstate on the client side... However, warning... if you do not need the other adaptewrs do not install them in your project as they override everything automatically and there is no method I know of to not allow the adapters controls it targets dynamically or explicitly...

The cool thing though is they provide all the source for it - so it may mean you can at least write an custom extender control for treeview that will integrate nicely with ajax...

Just a suggestion - and as usual unsure if I ever know what I am talking about...

Ajax Beta 1, UpdatePanel and Viewstate issue

Hi all,

I have found what could be a possible bug in the beta 1 regarding the use of the UpdatePanel with postback events.

If we use the update panel and inside it there is a control like a linkbutton that raise a postback, then the event is generated on the server and everything is going on correctly.

In my scenario I have a base page class that overrides the Viewstate load and save methods to compress and decompress it.A simply code that work fine without ajax and with the atlas ctp.(the code put the compressed viewstate content in another hidden field and let the original __VIEWSTATE empty).

With beta1 I've found that with a viewstate compression, this cause the postback events not raised with the right postback value.This happens for example when we click for the second time to the link button, when the viewstate has to be regenerated from the previous click.

I don't know what happens but I think that something has changed in the way the beta1 and UpdatePanel look at the viewstate.

Anyone has had the same issue ?

I just had this problem occur to me this afternoon. Upgraded to the new beta 2 from Atlas and the controls inside my update panels that stored values in ViewState started behaving funny. I too was inheriting from a base class that compressed and cached ViewState. As soon as I took this out and went back to System.Web.UI.Page, the controls worked fine again. This really sucks as we were able to trim so much bloat out of the page by compressing the ViewState. It would be wonderful if MS would consider this.

Forza Milan!


Colt45, to get his scenario working, you would need to explicitly register the hidden field that stores the compressed value of viewstate with ScriptManager, so that the framework would know that it needs to send the updated value for this to the client during an async post-back. I am guessing that you currently use Page.ClientScript.RegisterHiddenField(...) to render your compressed view state. Change this to ScriptManager.RegisterHiddenField(...)

This should fix your issue.

Hope that helps!


Thank you very much, kashif

It works well now...


Sorry...my previous post was wrong...it doesn't work!

I' ve used the ScriptManager.RegisterHiddenField as you suggest but nothing changed.

I need a solution because the viewstate compression is a usefull feature that I don't want to give up, as like as I don't with Ajax...


It did not work for me either.

Most of the problems I see are occuring in GridViews with paging and/or sorting. For example, I have a sorting routine that sorts ASC the first time the header is clicked and then DESC if it is clicked again. The value is stored in ViewState. The first time I click the header, the columns sorts ASC as expected. At this point, "ASC" is stored in ViewState so that when the header is clicked again, I can check this value and then sort by the reverse ("DESC"). However, the grid sorts ASC with every click because the new value is not persisting.

Paging also causes problems. The page data will refresh on the screen correctly between pages 1, 2, 3 etc. However, if I click a button in the 3rd row on the 3rd page that is supposed to update that customer record, it will actually retrieve the customer record that is on the 3rd row of the 1st page. In other words, Ajax always thinks the grid is on the 1st page even though the data on the screen reflects the 3rd page.

If I turn off compressing/caching ViewState, it works fine.
If I leave compression/caching enabled, but turn of Ajax, it works fine.
But together, the marriage fails.


protected override void SavePageStateToPersistenceMedium(Object pViewState)
{
Pair pair1;
System.Web.UI.PageStatePersister pageStatePersister1 = this.PageStatePersister;
Object ViewState;
if (pViewState is Pair)
{
pair1 = ((Pair)pViewState);
pageStatePersister1.ControlState = pair1.First;
ViewState = pair1.Second;
}
else
{
ViewState = pViewState;
}

LosFormatter mFormat = new LosFormatter();
StringWriter mWriter = new StringWriter();

mFormat.Serialize(mWriter, ViewState);
String mViewStateStr = mWriter.ToString();

byte[] pBytes = System.Convert.FromBase64String(mViewStateStr);

pBytes = Compress(pBytes);

String vStateStr = System.Convert.ToBase64String(pBytes);

pageStatePersister1.ViewState = vStateStr;

pageStatePersister1.Save();

//ClientScript.RegisterHiddenField("__MSPVSTATE", vStateStr);

}

protected override Object LoadPageStateFromPersistenceMedium()
{
System.Web.UI.PageStatePersister pageStatePersister1 = this.PageStatePersister;
//try
//{
pageStatePersister1.Load();
//}
//catch
//{
// return null;
//}

String vState = pageStatePersister1.ViewState.ToString();

byte[] pBytes = System.Convert.FromBase64String(vState);

pBytes = DeCompress(pBytes);

LosFormatter mFormat = new LosFormatter();

Object ViewState = mFormat.Deserialize(System.Convert.ToBase64String(pBytes));

return new Pair(pageStatePersister1.ControlState, ViewState);
}


Using ScriptManager.RegisterHiddenField(...) works fine in Beta 2 as long as you set the first argument as an update panel. The update panel can be empty, and should have its UpdateMode set to Always. UsingFiddler you should be able to see your new viewstate hidden field change appropriately.

Whether this is any better or worse than the code in the previous post, I don't know.

Andy

1protected override object LoadPageStateFromPersistenceMedium()2{3string viewState = Request.Form["__VSTATE"];4byte[] bytes = Convert.FromBase64String(viewState);5bytes = Compressor.Decompress(bytes);6LosFormatter formatter =new LosFormatter();7return formatter.Deserialize(Convert.ToBase64String(bytes));8}9protected override void SavePageStateToPersistenceMedium(object viewState)10{11LosFormatter formatter =new LosFormatter();12StringWriter writer =new StringWriter();13formatter.Serialize(writer, viewState);14string viewStateString = writer.ToString();15byte[] bytes = Convert.FromBase64String(viewStateString);16bytes = Compressor.Compress(bytes);17ScriptManager.RegisterHiddenField(this.updVS,"__VSTATE", Convert.ToBase64String(bytes));18}

Hi,

I to am experiencing this problem, i'm using Ajax RC1. I would take the option to use the scriptmanager but i have 2 major problems with this solution, i have a master page that contains the scriptmanager, and i want to apply this to all my existing pages. How can i reference the scriptmanager on the master page from the base class? If at all possible?


Kind regards,

Pedro Costa


Useshunzimm solution above. A slightly modified version of it worked well for me. I have ScriptManager on my master page and it works fine.


This might perhaps be due to changes in the ajax framework, but I've found that you do not need a update panel for ScriptManager.RegisterHiddenField() to work. I just used this as the first param and everything seems okay so far.


Thanks for this post, fixed my issue too with using scriptmanager. One question I have is does it buy anything to have this viewstate compression code on top of IIS 6 HTTP Compression or does http compression make this code obselete?


I've been trying to use the compression code in my application and I'm finding that it's causing problems with a few gridviews that I'm using. What's happening is that the 'OnRowUpdating' and the 'OnRowCancelingEdit' events are not being fired. I have an 'update' and 'cancel' LinkButton inside an 'EditItemTemplate' tag in a 'TemplateField'. The 'OnRowEditing' and the 'OnRowDeleting' events are being fired, but not the other two. Do you have any idea why this might be happening? Any help would be greatly appreciated.

AJAX Beta - Undo the changes

It was going so well. Everything worked great, now I have to rewrite my app. Whoever had the idea to require extenders to be in the same panel is fired. This is killing me.

An extender can't be in a different UpdatePanel than the control it extends.

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: An extender can't be in a different UpdatePanel than the control it extends.

hello.

well, that's just to guarantee that you don't get orphaned extenders...

ajax based page need to go to the top of the page....

Hi everyone ,,,

i have a page that contain update panel , that uses partial rendering ..

i need to go to the top of the page after postBack ... how do i do this ?

thnx ..


Why would you want a postback if you are using Update PanelSmile

The Update Panel and other partial rendering sections are solely meant for avoiding the page from going to the top for each and every action and retainng the scroll position.

Is there a specific reason you want the page to scroll up?


i need it because i have a gridview at the bottom of the page that i select a row from it ,

and i get an information about the row at the top of the page , if i have a lot of rows when i select a row i stay on the position of the row and the info is not display for

the user, the user need to scroll to the top of the page ..



Use this Peace of Code:
-------------------------------
<!--Add the following after the scriptmanager on your page:-->

 <script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {
window.scrollTo(0,0);
}
</script>

--------------------------------

If that doesnt work for some reason, try this

Use HTML Bookmarks to achieve this without a Postback

1) Place HTML Bookmark <a name="top" >TOP</a> on Top of the Page

2) Use Response.Redirect("PageURL#top) to go to the top of the page

Read more about Bookmark on this:
http://www.freewebmasterhelp.com/tutorials/html-basics/4

Shrinand Vyas

Monday, March 26, 2012

AJAX asynchronous calls without update panel

Is the UpdatePanel always needed to make Asynchronously calls to the server? I was catching up with the client side capabilities for the framework using the $get and $sys client classes and seem to provide a lot of functionality. Any samples, tutorials where I can go to get some reference. I went through the AJAX framwework documentation but no help.

No, you can also use webservices or pagemethods take a look at these links:

http://www.asp.net/ajax/documentation/live/overview/AsynchronousLayerOverview.aspx

http://www.asp.net/ajax/documentation/live/tutorials/ExposingWebServicesToAJAXTutorial.aspx

http://www.asp.net/ajax/documentation/live/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx

Hope this helps,
Elias.

Ajax Asynchronous call

Hi

Can any one tell me how many asynchronous call can we make from an ajax webpage.I mean to say that if we are using update panel to implement any ajax functionality then how many maximum update panels can we put on our webpage along with one timer control extender for each update panel.Is there any limit for that?

In my application if i am using two update panels then the application refreshes the page without postback, but if i add third update panel control to the page and use timer extender to refresh then the page refreshes with postback.Please help me out in solving the issue..


Hi,

As far as I know, IE allows 2 simultaneous connections at maximum.


Priyank Joshi:

but if i add third update panel control to the page and use timer extender to refresh then the page refreshes with postback

But this issue doesn't seem to be related with the connection limitation. Can you show me a simple sample page of the issue?

AJAX Async postback

Hi

I have a WebForm in this web form i am dynamically loading 6 User Controls these user controls has ajax update panel. & these update panel have web controls.

Now when i click any control of any UCs that click is causing a page post back. due to this all my other cotrols are getting reloaded & respectibve UCs page load is getting fired. I want to restrict this.

I want to add condition on each UC's page load event to check whether this postback is caused due to some other UC's event. If it is caused due to some other UCs event then dont process anything. If it is caused due to its own event then only process it.

I need this cause i see the performnce impact of this.

Hi,

if you set UpdateMode rproperty for each UpdatePanel to "conditional" you can avoid updating all update panels on every click. You will also need to check that your ChildrenAsTriggers property is set to "true".

However, if you do some time consuming procesing on the server you will still need to check which control caused asyncpostback.

-yuriy
http://couldbedone.blogspot.com


Hey yuriy

Thanks for your response. Can you jsut tell me how can i check which control caused Asyncpostback...thats what am lookinh for.


Property of the ScriptManager: AsyncPostBackSourceElementID

AJAX animation panel

Hello forum! I have an aspx page with a panel, 1 button and 2 animation extender. The button is associated to one of the animation extender and it has in the property "OnClientClick"=return false;

This is all working well.

In the panel I have 1 label that I want is values to change always I click in the button. But, because of the property "OnClientClick"=return false; all the code that I have in the OnClick of the Button doesn't work! If I took of the property, the animation panel don't show...

Here is the code I have in my button:

Protected Sub btnInfo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInfo.Click

lbl_name.Text = "Liliana"

End Sub

Please help me!!

Thanks

????????????????

Liliana

Portugal

Hi Liliana

As far as i know, there is no way to do waht you want to do in that method. The button either works on the client OR the server not both

However, you could add a page method to populate the button's click event like this

<asp:button id="btnLilianaButton" runat="server" Text="Click Me" OnClientClick='<%# LilianaPageMethod()%>' />

and on the Page code-behind have a method like this

public string LilianaPageMethod(){return"javascript:$get('" + lbl_name.ClientID +"').innerText = 'Liliana';return false;";}

This statement is evaluated when the page is rendered only so is pretty static. You could also use a WebMethod via javascript if you so wished and this could interact fully with the server

Hope this helps


Tim


Hello Tim! Thanks for your help but I solve the problem by other way.

I put the panel inside an AJAX Update Panel and the code inside the Load Event of the Update Panel. And it works fine!

Thanks,

Liliana

ajax animation extender

hi..

im new to asp ajax..i created image dynamically...and if i click the image panel should be displayed by using animation extender..

i have to write the animation extender in java script...by getting the image ID from code behind...is it possible...


Hi Rajukv,

I think you should better set the AnimationExtender's TargetControlID on the server side. For example:

<%@. 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">protected void Page_Load(object sender, EventArgs e) { Image myImage = new Image(); myImage.ID = "myimage"; myImage.ImageUrl = "~/pic/upg_HomeBasic.jpg"; this.Panel1.Controls.Add(myImage); this.AnimationExtender1.TargetControlID = "myimage"; }</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 ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Panel ID="Panel1" runat="server" Height="300px" Width="600px"> <ajaxToolkit:AnimationExtender ID="AnimationExtender1" runat="server"> <Animations> <OnHoverOver> <Parallel Duration=".1" fps="50"> <Resize Width="250" Height="250" /> </Parallel> </OnHoverOver> <OnHoverOut> <Parallel Duration=".1" fps="50"> <Resize Width="50" Height="50" /> </Parallel> </OnHoverOut> </Animations> </ajaxToolkit:AnimationExtender> </asp:Panel> </form></body></html>

I hope this help.

Best regards,

Jonathan


Thank u Jonathan .

i got it by using ModelpopUp with animation...by taking Modelpopup TargetControlID=hiddenbutton


AJAX and window.open dos not work

Hi,

I Have Page that uses AJAX Update panel and with in the panel i have button that contans the following

Response.Write("<script>window.open('default2.aspx',target='new');</script>")

when i click the button exception will happen saying that can not parse from the server.

any one out there that can help me solve this problem..

Thanks

If AJAX is used in your webpage, that script doesn't work anymore.

I guess you could do like below:

<asp:Button ID="btn1" runat="server" Text="OpenNew" OnClientClick="OpenNew();"></asp:Button><input type="hidden" id="hidFlag" runat="server" value="False"/><script type="text/javascript">function OpenNew(){ setInterval('Open()', 100);}function Open(){ flag = document.getElementById('hidFlag'); if (flag) { if (flag.value !='False') { window.open('default2.aspx', target='new'); flag.value ='False'; } }}</script>Code Behind:Protected Sub btn1_Click(byval sender asObject, byval e as EventArgs)Handles btn1.Click hidFlag.value ="True"End Sub

JasonMDLi:

If AJAX is used in your webpage, that script doesn't work anymore.

I guess you could do like below:

<asp:Button ID="btn1" runat="server" Text="OpenNew" OnClientClick="OpenNew();"></asp:Button><input type="hidden" id="hidFlag" runat="server" value="False"/><script type="text/javascript">function OpenNew(){ setInterval('Open()', 100);}function Open(){ flag = document.getElementById('hidFlag'); if (flag) { if (flag.value !='False') { window.open('default2.aspx', target='new'); flag.value ='False'; } }}</script>Code Behind:Protected Sub btn1_Click(byval sender asObject, byval e as EventArgs)Handles btn1.Click hidFlag.value ="True"End Sub

I've got the same issue asazuomar. What if the url for the new window is not fixed but has parameters, let's say, window.open('default2.aspx?query=4323',target='new'), and the "query" parameter has the value from some calculation that occurs inside the event btn1_Click (in your sample). What then?


nistam:

I've got the same issue asazuomar. What if the url for the new window is not fixed but has parameters, let's say, window.open('default2.aspx?query=4323',target='new'), and the "query" parameter has the value from some calculation that occurs inside the event btn1_Click (in your sample). What then?

You can pass the value to the hidden control "hidFlag" or to another hidden control.

<asp:Button ID="btn1" runat="server" Text="OpenNew" OnClientClick="OpenNew();"></asp:Button><input type="hidden" id="hidFlag" runat="server" value="False"/><input type="hidden" id="hidFlagValue" runat="server" value=""/><script type="text/javascript">function OpenNew(){ setInterval('Open()', 100);}function Open(){ flag = document.getElementById('hidFlag'); flagvalue = document.getElementById('hidFlagValue'); if (flag && flagvalue) { if (flag.value != 'False') { window.open('default2.aspx?query='+flagvalue.value, target='new'); flag.value = 'False'; } }}</script>

Code Behind:
Protected Sub btn1_Click(byval sender asObject, byval e as EventArgs)
Handles btn1.Click
hidFlagValue.value = 4323
hidFlag.value ="True"
End Sub


Yes this works, but its not a good way of doing it, with this i will keep the client PC checking on the flag always.

if there is no other way then i will be forced to use it.

But thank you for the help, you code give me many ideas... Thanks


It works fine for me too! I just need to create as many hidden values as the number of parameters.

Thanks.


azuomar:

Yes this works, but its not a good way of doing it, with this i will keep the client PC checking on the flag always.

if there is no other way then i will be forced to use it.

But thank you for the help, you code give me many ideas... Thanks

I knew it's not the best way. However, you could declare a handle variable returned from method "setInterval" and dispose it in method "Open()".


Thanks

Hi,

hope the follwoing will help without setting up the any client side flags :)

string

openPopupJS ="openpopup();";

ClientScript.RegisterStartupScript(

this.GetType(),"openPopupJS", openPopupJS,true);

Cheers,

venky

Saturday, March 24, 2012

ajax and master page

Hello I have a problem I am using ajax and I have a aspx page that belongs to a master page. I am using the update panel on the aspx page and want to acheive the following When the user clicks a ButtonLink in the aspx page I want it to trigger the button OnClick on the master page. I have tried the following;

/*This is in the aspx page*/ ... ...

<atlas:UpdatePanel ID="UpdatePanel" runat="server">
<ContentTemplate>
...
...
</ContentTemplate>
<Triggers>
<atlas:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</atlas:UpdatePanel>

Button1 is in the master page! But nothing happends.. Have I missed out on something?

Yes, what you're doing with the above code is telling the update panel to update when Button1 is clicked.


First, you need to set the update panel's UpdateMode to Conditional.

Next, make sure the ScriptManager's EnablePartialRendering is set to True.

You may need to set your trigger programmatically and use FindControl.


So if I have one button in my master page and one linkbutton in my aspx page could I

add a update panel to the button in the masterpage. set this update panels trigger to the link button in the aspx page?

would this work? im thinking how can I get the id of the linkburtton in the aspx page?

tnx


you want to go the other way; set the trigger of the update panel in the master page from the content page. An example is here: http://msdn2.microsoft.com/en-us/library/xxwa0ff0.aspx


What error you are facing...

whether you places SCriptManager on Master Page or not ?

http://ajax.asp.net/docs/mref/T_System_Web_UI_UpdatePanel.aspx


Hi Guys my problem is very simple i have a masterpage with all my menus and headers and footers. Now what i want is when i click on the menus or buttons on the left i want to update only contentplaceholder with new page and controls of that page. is it possible!!! if yes plz tell me how.

Faisal

chetan.sarode:

What error you are facing...

whether you places SCriptManager on Master Page or not ?

http://ajax.asp.net/docs/mref/T_System_Web_UI_UpdatePanel.aspx


Yes.

You can build your content pages as user controls...

Then your menu items can fire a function that loads the controls into your place holder... That way only the place holder is being updated...

But you won't need to do that in a "master page"... that sort of defeats the purpose. Just create your header/menu/footers in default.aspx, otherwise, you will just need a blank default.aspx page loading at the begining.

Master pages don't load on their own.


Thanks i will do that and let you inform what i have got.

Faisal

ajax and linkbutton problem, it is difficulty ,i cannot resolve it , help me

I use Asp.net Ajax exten1.0 encounter some question,so I need your help

My problem is :

I use two UpdatePanel in one aspx ,we can call left panel ,and right panel

At right panel ,I need to automatism make a server table ,and in every table cell ,I must bind a linkbutton in there , as linkbutton , the linkbutton text data is from database, linkbutton bind it ,and linkbutoon commandArgument are bind data also ,

now , I encounter problem is , when I click linkbutton , but not trigger linkButton _command this Event ,so I cannot get commandArgument value.to diplay at updatepanel1 ,but ,I assurance I register this Event , when the linkbutton automatism make ,sure I use this method

eg:

lnkButton =New LinkButton() ' add Event

AddHandler lnkButton.Command,AddressOf lnkButton_Command

eg : add trigger

Dim trigger As AsyncPostBackTrigger = New AsyncPostBackTrigger() trigger.ControlID = lnkButton.ID UpdatePanel2.Triggers.Add(trigger) I Add tirggers but , in html source I cannot find like these code , Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1','tUpdatePanel2'], ['btnConfrim','CalendarSelect','k0_0_0_0','k0_0_0_1','k0_0_0_2','k0_0_0_3','k0_0_1_0','k0_0_1_1','k0_0_1_2','k0_0_1_3','k0_0_2_0','k0_0_2_1','k0_0_2_2','k0_0_2_3','k0_0_3_0','k0_0_3_1','k0_0_3_2','k0_0_3_3','k0_1_0_0','k0_1_0_1','k0_1_0_2','k0_1_0_3','k0_1_1_0','k0_1_1_1','k0_1_1_2','k0_1_1_3','k0_1_2_0','k0_1_2_1','k0_1_2_2','k0_1_2_3','k0_1_3_0','k0_1_3_1','k0_1_3_2','k0_1_3_3','k0_2_0_0','k0_2_0_1','k0_2_0_2','k0_2_0_3','k0_2_1_0','k0_2_1_1','k0_2_1_2','k0_2_1_3','k0_2_2_0','k0_2_2_1','k0_2_2_2','k0_2_2_3',This 'k0_2_0_3' is linkbutton ID , That is why , thank you for your help

Your English is a bit shaky, so it was difficult to decipher exactly what is going on. However, one thing for sure that you are doing wrong is that you cannot create triggers programmatically. That is stated in the UpdatePanel Class page. If you simply use the ChildrenAsTriggers property set to true which is default, then when a link is clicked it will trigger the UpdatePanel update. However the issue of the command argument not available can be a bit more complex. It depends on the order of events and that is too complex to anayze without a simplified version of your code posted here. (Use the code editor button above to paste it a bit more neatly).

An example of why this might be necessary is that the order of page events can be affected by what is done during the page life cycle. For example I have seen the order of 2 events reverse simply by doing a FindControl or not in a method. There are muliple points in the life cycle where a control can Bind for instance and it may in fact Bind multiple times without you knowing it. That's just the way it works.

I would suggest that you add a Trace to all relevant events and check the order of events as that can sometimes give you insight. I have a very complex GridView run in Ajax, and without Trace events, I never would have been able to figure out what was wrong during edit with 2 way binding templates, column re-ordering, multi-column sorting, paging, etc all of which occur with Ajax.


sorry , my english is very poor.

my code is :

Protected Sub Page_Load(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Me.Load createTable()End Sub'Public Sub createTable()For iAs Integer = 0To 5Dim rowAs TableRow =New TableRow()For jAs Integer = 0To 6Dim cellAs TableCell =New TableCell() cell.Controls.Add(CreatePerSolt(i, j)) row.Controls.Add(cell)Next tabShecule.Controls.Add(row)Next End Sub Public Function CreatePerSolt(ByVal iAs Integer,ByVal jAs Integer)As TableDim tabAs Table =New Table tab.ID = i &"_" &"_" & jFor kAs Integer = 0To 3Dim rowAs TableRow =New TableRow()For hAs Integer = 0To 3Dim cellAs TableCell =New TableCell() lnkButton =New LinkButton() lnkButton.Text ="k" & i &"_" & j &"_" & k &"_" & h lnkButton.ID ="k" & i &"_" & j &"_" & k &"_" & h lnkButton.CommandArgument ="k" & i &"_" & j &"_" & k &"_" & hAddHandler lnkButton.Command,AddressOf lnkButton_CommandDim triggerAs AsyncPostBackTrigger =New AsyncPostBackTrigger() trigger.ControlID = lnkButton.ID trigger.EventName ="Click" UpdatePanel2.Triggers.Add(trigger) cell.Controls.Add(lnkButton) row.Controls.Add(cell)Next tab.Controls.Add(row)Next Return tabEnd Function Protected Sub lnkButton_Command(ByVal senderAs Object,ByVal eAs System.Web.UI.WebControls.CommandEventArgs)Handles lnkButton.Command Label18.Text = e.CommandArgument.ToString()End Sub

I think you have to try this a different way to start.

http://www.asp.net/AJAX/Documentation/Live/mref/T_System_Web_UI_UpdatePanel.aspx

Please note the following statement:

You can add anUpdatePanel control programmatically, but you cannot add triggers programmatically. To create trigger-like behavior, you can register a control on the page as an asynchronous postback control. You do this by calling theRegisterAsyncPostBackControl(Control) method of theScriptManager control. You can then create an event handler that runs in response to the asynchronous postback, and in the handler, call theUpdate() method of theUpdatePanel control.

However because your table is inside the UpdatePanel, if you have ChildrenAsTriggers default set to true,all the LinkButtons should trigger an update without needing to register them. Just remove the trigger code. Once that is done if you still do not get a CommandArgument, post the UpdatePanel markup so that this can be duplicated.

AJAX and image Background

Hi,

I am using panel with in AJAX update panel, the panel background is using an image. So first time I run the form the panel will be displayed with the background image that I have set up, but when I click a button and partial update happen the panel background image will disappear. Can any one help me to keep the background of the panel even if partial update happens.

Place your Panel inside the UpdatePanel and that will solve your problem most likely. If that is not a solution because the panel contains other controls outside the updatepanel it contains then just wrap the the panel with a update panel and retain the current one you have. Nothing prvents you from having multiple update panels. No idea why you're experiencing the problem unless somehow the divs / spans created by the panels get mishandled or something but try the two possible workarounds listed above and see if that fixes it...

Thanks for the replay,

I have the background set up on the master page which contains the panel and inside the panel is the content place holder, The panel is setup with background image, when partial update trigger, the background image for the page that is displayed within the content place holder will disappear but for the remaining panel still contain the background image,


Hi!! put your panel inside the update panel and also the other controls. It will trigger the page. u wil get the image displayed.Wink
Thanks, I have missed some controles to be inside the update panel.

Ajax and IE6 - IE7 runs very very slow... Firefox is fast

Hi guys... i just implementa site that uses ajax update panels.. one page have an ajax update panel with asimple post back data (in change index event of a drop down a record shows tothe user) quite simple!

BUT the problems startswhen i upload the site in a production server , every update panel runs veryvery slow with IE7 or IE6 but in firefox works like a charm..

I made the following changes just to know but NOTHING CHANGED...Tongue Tied

<compilation debug="false"><system.web.extensions> <scripting> <scriptResourceHandler enableCompression="true" enableCaching="true"/> </scripting></system.web.extensions> 


i set also the EnableViewState =false to several items inside the page but did'nt see any change in production server..

Help ME PLEASE!!!

hello.

hum...do you have an anti-virus on? are we talking about how much data inside the updatepanel?


no antivirus..

look..

i have an update panel that contains a dropdown box with 3 values

This dropdown is autopostback=true

Also inside the Update panel is a second DropDbox that is conected to a datasource that changes the where clause value from the 1st Ddownbox selected value..(the table contains indexes and there are 80 records ONLY)

is quite simple.. User chooses for example CARS , and the second dropdown manipulates cars brands .. chooses motorbikes ,the second dropdown manipulates bikes..
I do not understand why in firefox is quite fast and in IE7 is VERY very slow...

is it a matter of the production server? or is a general known problem of ajax asp.net with IE6,7?



is there anyone with the same situation?

Wednesday, March 21, 2012

Ajax and Dynamically created controls.

I have an app where I add images to a panel based on what a user selects from a drop down list. Under internet explorer and opera it works fine. but the html code generated in firefox and netscape is missing the events. When I debug with IE or OPERA as default browser in vs 2005 events are fired. When Netscape or Firefox are set as default events (for the images) are not fired. I looked at the code being generated by the server and there are no events in the html code for the images. Here is what I get.

<li class="zipitem"><input name="zipselect1$ziprepeater$ctl01$selectbtn"id="zipselect1_ziprepeater_ctl01_selectbtn"class="imagebtn"src="images/selectbtn.gif"alt="Select"style="border-width: 0px;"type="image"><span id="zipselect1_ziprepeater_ctl01_ziplbl">12836</span></li><li class="zipitem"><input name="zipselect1$ziprepeater$ctl02$selectbtn"id="zipselect1_ziprepeater_ctl02_selectbtn"class="imagebtn"src="images/selectbtn.gif"alt="Select"style="border-width: 0px;"type="image"><span id="zipselect1_ziprepeater_ctl02_ziplbl">12851</span></li>
<li class="zipitem"><input name="zipselect1$ziprepeater$ctl03$selectbtn"id="zipselect1_ziprepeater_ctl03_selectbtn"class="imagebtn"src="images/selectbtn.gif"alt="Select"style="border-width: 0px;"type="image"><span id="zipselect1_ziprepeater_ctl03_ziplbl">12852</span>
this is just a code scrap. The page looks fine in all browsers but the Mozilla browsers dont work. You should be able to click on the images which takes and adds the zipcodes the images represent into a gridview. As I said works in IE and Opera fine.
 
 
 

See this is Browser compatibility issue....

Can you post some code details so it will help..

Which version of Firefox you used...

I suggest try yo use latest version...


It is a browser issue? I thought asp.net server side created the code for each browser. Any way if I.E worked the way it should I would not need Ajax to solve this problem. It is the only browser of the four I have tested that causes the screen to flash when clicking on the images. of course I could have some setting wrong which IE requires that the others don't.

The follow code produces a number of images on the page. When an image is clicked it gets put into a data grid.

see first post for code scrap generated for mozilla browsers . As can be seen there there is no event code created for the images.

As for code here is html source

<%@. Control Language="c#" AutoEventWireup="false" Codebehind="zip_selector.ascx.cs" Inherits="active.UserControls.zip_selector" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%
<br>
<div id="div_selectedzip">
<asp:label runat="server" id="lblSelZip"> Set of Selected Zipcodes: </asp:label><asp:button id="btnRemoveAll" runat="server" text="Remove All" visible="False"></asp:button><asp:repeater id=selectedzip runat="server">
<headertemplate>
<ul style="list-style-type: none">
</headertemplate>
<itemtemplate>
<li class="selectedzipitem">
<asp:label id="Label2" runat="server"><%#DataBinder.Eval(Container.DataItem, "zip_code") %></asp:label>
<asp:linkbutton id="removelnk" runat="server" commandname='<%# DataBinder.Eval(Container.DataItem, "zip_code") %>'>Remove</asp:linkbutton
</li>
</itemtemplate>
</asp:repeater>
<div style="CLEAR: both"></div> <!-- This is to make Opera load correctly for fieldsets -->
</div>
<br>
<div id="div_cntyzip">
<div id="instructTxt"><p>Enter one or
more zip codes in the text box separated by commas. Or you can add to set of selected zip
codes from a county. If you are interested in one of the <a onclick="window.open('glossary.htm', 'Glossary', 'width=432,height=270,toolbar=0,scrollbars=1,screenX=200,screenY=200,left=200,top=200')" href="http://links.10026.com/?link=javascript:void(0)" >non-standard zipcodes</a>, type one or more of the
following values separated by commas: <b>invalid,
illegible, unreported, irregular, or private</b>.</p></div>
<asp:label id="zipErrMsg" runat="server" forecolor="Red" visible="False">* Error:</asp:label>
<span>Zip Code:</span><asp:textbox id=txtZip runat="server"></asp:textbox><asp:button id=btnSelectZip runat="server" text="Add to Set"></asp:button>
<asp:Button id="btnAddAllZip" runat="server" Text="All NYS Zipcodes"></asp:Button><br>
<div style="DISPLAY: inline; WIDTH: 70px; HEIGHT: 15px" ms_positioning="FlowLayout">OR</div><br
<span>Add to Set of Selected Zipcodes from County: </span><asp:dropdownlist id=cntyzipddl runat="server" autopostback="True"></asp:dropdownlist>
<asp:repeater id=ziprepeater runat="server" OnItemCommand="ziprepeater_ItemCommand1" >
<headertemplate>
<ul style="list-style-type: none">
</headertemplate>
<itemtemplate>
<li class="zipitem">
<asp:imagebutton id="selectbtn" runat="server" cssclass="imagebtn" alternatetext="Select" imageurl="../images/selectbtn.gif" commandargument='<%#DataBinder.Eval(Container.DataItem, "cnty_code") %>' commandname='<%#DataBinder.Eval(Container.DataItem, "zip_code") %>'></asp:imagebutton>
<asp:label id="ziplbl" runat="server"><%#DataBinder.Eval(Container.DataItem, "zip_code") %></asp:label>
</li>
</itemtemplate>
<footertemplate>
</ul>
<div class="spacer"> </div>
</footertemplate>
</asp:repeater>
<div style="CLEAR: both"></div> <!-- This is to make Opera load correctly for fieldsets -->
</div>
<br
here is code behind page in c#

namespace active.UserControls
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using active.DataAccessLayer;
using active.Common;

/// <summary>
/// Summary description for zip_selector.
/// </summary>
public class zip_selector : System.Web.UI.UserControl
{
#region Properties
protected System.Web.UI.WebControls.Repeater ziprepeater;
protected System.Web.UI.WebControls.Repeater selectedzip;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label zipErrMsg;
protected System.Web.UI.WebControls.Label lblSelZip;
protected System.Web.UI.WebControls.TextBox txtZip;
protected System.Web.UI.WebControls.Button btnSelectZip;
protected System.Web.UI.WebControls.DropDownList cntyzipddl;
protected System.Web.UI.WebControls.Button btnRemoveAll;
protected System.Web.UI.WebControls.Button btnAddAllZip;
protected bool bBadZipFound=false;
private int MAXZIP;

private int MAXZIPCOUNT
{
get {return 300;}
set {MAXZIP = value;}
}

public bool All_ZIP_SELECTED
{
get
{
object o = ViewState["All_Zip_Selected"];
if (o == null)
return false;
else
return (bool)o;
}
set { ViewState["All_Zip_Selected"] = value; }
}

private string CountyCode
{
get
{
object o = ViewState["CountyCode"];
if (o == null)
return "00";
else
return o.ToString();
}
set { ViewState["CountyCode"] = value; }
}

public DataTable SelectedZipTable
{
get
{

DataTable t = ViewState["SelectedZip"] as DataTable;
if (t == null)
{
t=new DataTable("SelectedZip");
DataColumn dc = new DataColumn("zip_code",System.Type.GetType("System.String"));
DataRow dr = t.NewRow();
t.Columns.Add(dc);
dr["zip_code"] = "None Selected";
ViewState["SelectedZip"] = t;
}

return t;
}
set { ViewState["SelectedZip"] = value; }
}
public bool BadZipFound
{
get
{
return bBadZipFound;
}
}
public event EventHandler BubbleClick;
#endregion

#region Page Events
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
zipErrMsg.Visible = false;
if (!Page.IsPostBack)
{
CountyList lstCounties = Lookups.Counties;

//Filter out the non-standard county codes. All nonstandard counties have a sort_order
//greater than 990.
DataView dv = lstCounties.Tables[0].DefaultView;
dv.RowFilter = "sort_order < 990";
//lstCnty.DataSource = lstCounties;
cntyzipddl.DataSource=dv;
cntyzipddl.DataMember = lstCounties.counties.TableName;
cntyzipddl.DataTextField = lstCounties.counties.cnty_nameColumn.ColumnName;
cntyzipddl.DataValueField = lstCounties.counties.cnty_codeColumn.ColumnName;
cntyzipddl.DataBind();

ListItem item= new ListItem("Select County","00");

cntyzipddl.Items.Insert(0,item);
cntyzipddl.SelectedValue = CountyCode;

BindZipRepeater();
BindSelectedZip();

}

}
protected override void OnPreRender(EventArgs e)
{
if (SelectedZipTable.Rows.Count > 0)
btnRemoveAll.Visible=true;
else btnRemoveAll.Visible=false;
base.OnPreRender (e);
}
#endregion

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
this.cntyzipddl.SelectedIndexChanged +=new EventHandler(cntyzipddl_SelectedIndexChanged);
this.ziprepeater.ItemCommand +=new RepeaterCommandEventHandler(ziprepeater_ItemCommand);
this.selectedzip.ItemCommand +=new RepeaterCommandEventHandler(selectedzip_ItemCommand);
this.btnSelectZip.Click += new System.EventHandler(this.btnSelectZip_Click);
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnRemoveAll.Click += new System.EventHandler(this.btnRemoveAll_Click);
this.btnAddAllZip.Click += new System.EventHandler(this.btnAddAllZip_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

#region User Public Methods

/// <summary>
/// Binds the zip selector datagrid to the results from list of zip codes retrieved by county
/// </summary>
public void BindZipRepeater()
{
DataSet dsZipSelect;
string cnty_cd = CountyCode;
DataTable dt;

dsZipSelect = Lookups.GetZipByCnty(cnty_cd);
dt = dsZipSelect.Tables[0];

//Add the option of selecting all zip codes in county
if (CountyCode!="00")
{
DataRow dr = dt.NewRow();
dr[1]="All County Zip";
dt.Rows.Add(dr);
}
/*//Add the option of selecting all NY zip codes
dr = dt.NewRow();
dr[1]="All NY Zip";
dt.Rows.Add(dr);
*/
ziprepeater.DataSource = dsZipSelect;
ziprepeater.DataMember = "ZipSelect";
ziprepeater.DataBind();

}

public void BindSelectedZip()
{
selectedzip.DataSource = SelectedZipTable;
selectedzip.DataMember = "SelectedZip";
selectedzip.DataBind();

int selectedCount = SelectedZipTable.Rows.Count;
lblSelZip.Text = "Set of Selected Zip Codes (" + SelectedZipTable.Rows.Count + " of " + MAXZIPCOUNT + " Max): ";

}
#endregion

#region Private Methods
private void lstCnty_SelectedIndexChanged(object sender, EventArgs e)
{
ListControl lstCnty = sender as ListControl;
if (lstCnty != null)
{
CountyCode = lstCnty.SelectedValue;
BindZipRepeater();
}
}

private void cntyzipddl_SelectedIndexChanged(object sender, EventArgs e)
{
ListControl lstCnty = sender as ListControl;
if (lstCnty != null)
{
CountyCode = lstCnty.SelectedValue;
BindZipRepeater();
}
}

private void ziprepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
{
OnBubbleClick(e);
string selectedZip = e.CommandName;
string selectedCnty = e.CommandArgument.ToString();
DataTable dt = SelectedZipTable;
zipErrMsg.Visible=false;
if (!All_ZIP_SELECTED)
{
//the zip is not already been added and the amount of selected zipcodes
//do not exceed MAXZIPCOUNT
if (dt.Rows.Count < MAXZIPCOUNT)
{
if (selectedZip == "All County Zip")
{
//Add all zips in the selected County
AddCountyZips();
}
else
{
AddSelectedZip(selectedZip);
}
}
else
{
zipErrMsg.Text = "You have exceeded the maximum of " + MAXZIPCOUNT.ToString() + " zip codes. Please narrow your search. <BR>";
zipErrMsg.Visible = true;
}
}
else
{
zipErrMsg.Text="All NYS zip codes have been selected. No need to add individual zipcode.<br>";
zipErrMsg.Visible=true;
}
}

private void selectedzip_ItemCommand(object source, RepeaterCommandEventArgs e)
{
string selectedZip = e.CommandName;
DataTable dt = SelectedZipTable;
string selectExpr = "zip_code ='" + selectedZip+"'";
DataRow[] foundRow = dt.Select(selectExpr);
zipErrMsg.Visible=false;

if (foundRow.Length >0)
{
dt.Rows.Remove(foundRow[0]);
if (selectedZip=="All NYS Zip")
{ All_ZIP_SELECTED = false;
}
BindSelectedZip();

}

}
//"Add to Set" button click method
private void btnSelectZip_Click(object sender, System.EventArgs e)
{
OnBubbleClick(e);
zipErrMsg.Visible=false;
//reset the select county table to avoid confusion
CountyCode="00";
cntyzipddl.SelectedValue = CountyCode;
BindZipRepeater();

if (!All_ZIP_SELECTED)
{
//parse and validate zip input string
string [] zips = zipinput_parser();
DataTable dt = SelectedZipTable;

//if valid zips are returned, add to Selected Zip table
if (zips != null)
{
foreach (string zip in zips)
{
//the zip is not already been added and the amount of selected zipcodes
//do not exceed MAXZIPCOUNT
if (dt.Rows.Count < MAXZIPCOUNT)
{
AddSelectedZip(zip);
}
else
{
zipErrMsg.Text = "You have exceeded the maximum of " + MAXZIPCOUNT.ToString() + " zip codes. Please narrow your search.<br>";
zipErrMsg.Visible = true;
break;
}
//blank out the zip textbox for another entry
txtZip.Text="";
} //end of foreach
} //end of if zip length==0

}
else
{
zipErrMsg.Text="All NYS zip codes have been selected. No need to add individual zipcode.<br>";
zipErrMsg.Visible=true;
}
}

public string[] zipinput_parser()
{
// split zip string between commas
string[] splitTxt = txtZip.Text.Split(new char[] {',',' '});
string validZips="";
string badZips="";
zipErrMsg.Text = "* Error: ";
zipErrMsg.Visible=false;
//check blank zip input
if (txtZip.Text == "")
{
zipErrMsg.Text += "Please enter a zip code value. <br>";
zipErrMsg.Visible = true;
}
else
{
string lowerZip;
//txtZip.Text = "";
foreach (string zip in splitTxt)
{
lowerZip = zip.ToLower();
lowerZip = lowerZip.Trim();
if (zip !="")
{
//check it is not one of the non-standard zip code values
if ((lowerZip != "private") &&(lowerZip != "invalid") && (lowerZip != "illegible") && (lowerZip != "unreported") && (lowerZip != "irregular"))
{ //zip code is invalid if zip is alpha or is not 5 digits long
if ((lowerZip.Length != 5)||!Validations.IsNumeric(lowerZip))
{
//zipErrMsg.Text = zipErrMsg.Text + lowerZip;
zipErrMsg.Visible = true;
//txtZip.Text = txtZip.Text + lowerZip + ",";
badZips= badZips + lowerZip + ",";
}
else validZips = validZips + lowerZip + ",";
}
else validZips = validZips + lowerZip + ",";
}
}
if (zipErrMsg.Visible)
{
bBadZipFound=true;
badZips = badZips.Remove(badZips.Length-1,1);
txtZip.Text=badZips;
zipErrMsg.Text = zipErrMsg.Text + badZips + " is not valid.";
if (validZips.Length>0)
{
zipErrMsg.Text += " Valid zips have been added to the selected zip table.";
}
zipErrMsg.Text += "<br>";
}
//remove last comma
if (validZips.Length>0) validZips = validZips.Remove(validZips.Length-1,1);
}
if (validZips =="")
return null;
else return validZips.Split(new char[] {','});

}

public string zipinput_parser(bool validateOnly)
{
// split zip string between commas
string[] splitTxt = txtZip.Text.Split(new char[] {',',' '});
string validZips="";
string badZips="";
zipErrMsg.Text = "* Error: ";
zipErrMsg.Visible=false;
//check blank zip input
if (txtZip.Text == "")
{
zipErrMsg.Text += "Please enter a zip code value. <br>";
zipErrMsg.Visible = true;
}
else
{
string lowerZip;
//txtZip.Text = "";
foreach (string zip in splitTxt)
{
lowerZip = zip.ToLower();
lowerZip = lowerZip.Trim();
if (zip !="")
{
//check it is not one of the non-standard zip code values
if ((lowerZip != "private") &&(lowerZip != "invalid") && (lowerZip != "illegible") && (lowerZip != "unreported") && (lowerZip != "irregular"))
{ //zip code is invalid if zip is alpha or is not 5 digits long
if ((lowerZip.Length != 5)||!Validations.IsNumeric(lowerZip))
{
//zipErrMsg.Text = zipErrMsg.Text + lowerZip;
zipErrMsg.Visible = true;
//txtZip.Text = txtZip.Text + lowerZip + ",";
badZips= badZips + lowerZip + ",";
}
else validZips = validZips + lowerZip + ",";
}
else validZips = validZips + lowerZip + ",";
}
}
if (zipErrMsg.Visible)
{
bBadZipFound=true;
badZips = badZips.Remove(badZips.Length-1,1);
zipErrMsg.Text = zipErrMsg.Text + badZips + " is not valid.";
zipErrMsg.Text += "<br>";
}
//remove last comma
if (validZips.Length>0) validZips = validZips.Remove(validZips.Length-1,1);
}
return validZips;

}
/// <summary>
/// Adds all the zip codes within a county
/// </summary>
private void AddCountyZips()
{
DataSet dsZipSelect;
string cnty_cd = CountyCode;
DataTable dt = SelectedZipTable;
DataTable cntyTable;
string zipCd;
int totalZip;

zipErrMsg.Visible=false;
dsZipSelect = Lookups.GetZipByCnty(cnty_cd);
cntyTable = dsZipSelect.Tables[0];
totalZip = dt.Rows.Count + cntyTable.Rows.Count;
if (totalZip < MAXZIPCOUNT)
{
foreach (DataRow aRow in cntyTable.Rows)
{
zipCd = aRow[1].ToString();
AddSelectedZip(zipCd);
}
}
else
{
zipErrMsg.Text = "You have exceeded the maximum of " + MAXZIPCOUNT.ToString() + " zip codes. Please narrow your search. <br>";
zipErrMsg.Visible = true;
}
}
private void AddSelectedZip(string zipcd)
{
DataTable dt = SelectedZipTable;
string selectExpr = "zip_code ='" + zipcd +"'";
DataRow[] foundRow = dt.Select(selectExpr);
if (foundRow.Length ==0)
{
DataRow dr = dt.NewRow();
dr[0]=zipcd;
dt.Rows.Add(dr);
BindSelectedZip();
}
}

private void btnRemoveAll_Click(object sender, System.EventArgs e)
{
SelectedZipTable.Clear();
zipErrMsg.Visible = false;
All_ZIP_SELECTED = false;
BindSelectedZip();
}

private void btnAddAllZip_Click(object sender, System.EventArgs e)
{
OnBubbleClick(e);
SelectedZipTable.Clear();
AddSelectedZip("All NYS Zip");
All_ZIP_SELECTED = true;
}
protected void OnBubbleClick(EventArgs e)
{
if(BubbleClick != null)
{
BubbleClick(this, e);
}
}
#endregion

protected void ziprepeater_ItemCommand1(object source, RepeaterCommandEventArgs e)
{

}

}
}

None of the click events for the images created on the fly fire as I said in first posting. You can see that the html generated by the server does not have any events.

Ajax and compile problem

Hey all,

I have a page with a gridview on it, when I put a scriptmanager and an update panel and the put the gv in the panel and publish I get an "the file xxx has not been precompiled and connot be requested" error. If i remove the ajax controls everything works ok, what have I done wrong?

tia

That seems like an odd problem to me. I'm using VS2005, and have the latest AJAX beta installed. I'm using gridviews and datalists in update panels and don't have any problems with them. Can you post more about your setup?

AJAX and ASYNC Pages

All,

I'm looking to implement the following scenario:

1. User clicks on a link.

2. A panel is raised indicating that a long running operation is about to begin.

3. A request to open a new window which will host an async page that will stream a pdf is made.

4. When the callback from the async page returns, I want it to trigger an action on the parent page to hide the progress panel.

Basically any examples of incorporating async page callbacks and ajax update panel callbacks.

Ariel

hello.

why do you need async pages to do this? is the server processing making a long web service call or perfomring an expensive db query?

The popup

http://ajax.alpascual.com/ModalPopup/ModalPopup.aspx

and then the PDF

http://alpascual.com/search/SearchResults.aspx?q=pdf

Hope that helps you finish the project

AJAX acting inconsistently

I have the following scenario:

Default.aspx -- start page (2 drop down lists)

I kept these 2 drop down lists under update panel ...but when i select drop down 1...it is also calling SelectedItemIndexChanged for Drop Down list 2...

When i commented out Updated Panel...then it is working properly...

How can i solve this situtation??

I phared the question in wrong way...

the thing that is happening is:

When i changed the Drop Down List 2, it is first calling SelectedItemIndexChanged of drop down list 1, then it is going to drop down 2 SelectedItemIndexChanged.

When i commented out Update panel...then it is working properly... How to tackle this situtation?

AJAX accordion panel scrolled in IE7 but fine in Firefox

I am using the ajax accordion panel toolkit in my default page. As below:

<ajaxToolkit:Accordion ID="Accordion" SelectedIndex="0" ContentCssClass="" HeaderCssClass="" HeaderSelectedCssClass=""
runat="server" FadeTransitions="true" FramesPerSecond="30"
TransitionDuration="350" AutoSize="None">
<Panes>
<ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server">

<Header>

...

Now the funny thing is the IE7 can't function at all on the default page, while firefox has no errors at all.

So did anyone have the same issue? is this a bug in the IE7?

...

You may find that IE is being pushed into quirks mode which may be causing you issues. The Toolkit assumes IE is instandards mode. For more information on Quirks Mode seehttp://en.wikipedia.org/wiki/Quirks_mode

-Damien


Thanks for your quick replay.

Here is my document type:

<!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" >

Refer to the Quirks table on Wiki, it's not Quirk under IE7.0

XHTML 1.0 Transitional doctype without an XML declaration
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">SSAAAAAAQ

Do you have any other solution?


There must be an overflow style being applied... Maybe you have something set in you CSS that is effecting your panel?

You can use Firebug to see applied styles (in Firefox) or the IE Developer Toolbar will do similar in IE.

-Damien


Yeah, you were right. I omited overflowed div segment, now it's working again.

Another method sharing is that:

when the table width = 100%, better to use the autoSize="Fill" in that case, the layout will be good, no scrolled bar on the side or bottom.