Showing posts with label panels. Show all posts
Showing posts with label panels. Show all posts

Wednesday, March 28, 2012

AJAX update panel updating all panels!

Hey there, I have 2 updated panels on a page update panel1 and update panel2.

One is triggerd by a list box and the other is triggered by an image button,, the only problem is although each trigger is assigned to their respective list boxes, whenever a trigger is activated it refreshes both update panels, which is not what I want.

This is my update panel refreshed by the image button

<asp:UpdatePanelID="UpdatePanel2"runat="server"><ContentTemplate><TABLEid="Table6"style="WIDTH: 208px; HEIGHT: 248px"cellSpacing="1"cellPadding="1"width="208"border="0"><TR><TDstyle="HEIGHT: 197px; width: 206px;"vAlign="top"align="center"><BR><asp:listboxid="ListBox1"runat="server"Width="143px"Font-Names="Arial"AutoPostBack="True"Height="232px"></asp:listbox></TD></TR></TABLE></ContentTemplate><Triggers><asp:asyncPostBackTriggerControlID="SearchButton"EventName="Click"/></Triggers></asp:UpdatePanel>

Any thoughts on this?

Thanks in advance

You need to set the UpdateMode on the UpdatePanels to "Conditional". By default it is set to "Always" which means it will be updated on any postback.

Saturday, March 24, 2012

Ajax timer and update panels

Is there a way that an updatepanel could be set (through an attribute) to ONLY update when something has changed without the need to write custom code?

For example, I have a page with an updatepanel on it that updates its contents every 10 seconds. However, I only want to refresh the data in that update panel when something in it has changed - not every single time the timer fires. The updatepanel has images in it and, because i do not want to display any cached results, I setResponse.CacheControl = "no-cache" and Response.AddHeader("Pragma", "no-cache")on page_init. The end result is screen flicker every 10 seconds).

It would be nice to have the update panel only update if something has changed by comparing the existing and the new data.

suggestions welcome - just email me or post a reply

Dan

Hi,dan.kotarski

I am afraid UpdatePanel cann't do this!

Maybe you can use WebService or PageMethod as an alternative, You can write some JS to compare the existing data and the new data in the result of WebService or PageMethod.

Let me know if you need more info.

Hope this helps.

Thanks!

AJAX Tabs

I am using a tab container with four tab panels. On the first panel is my user information 10 fields 8 are required and have required field validators attached to them. On the second tab is a button that when clicked checks the 8 required fields for validity. If they are not all filled in I would like to have the first tab become the selected tab. Is there anyway to do this? Just starting to work with ajax so any hints would be greatly appreciated.

I'll give it a look tomorrow at work!

Just replying so it gets in my posts and I will remember ;)

I'll get back to you,
Wim.


Ok smitty,

I made a small working example.

(It could be that you have to change the tagprefixes of the controlToolkit extenders)

I got my inspiration here:

You could read them to get full understanding of what I'm doing in the code:

Calling ASP.net validators with javascript (http://www.codeproject.com/useritems/JavascriptValidation.asp)

Thank you so much. This has solved my problem.

Thanks

Wednesday, March 21, 2012

Ajax TabControl and validation are incompatible - any way to resolve

Hi -

I've found out that the buttons in my tab panels no longer post back when I add validation on the input form. Is there a way around this? Has anyone solved this?

Thanks for ANY help or idea how to tackle ...

Oliver

Each tab have their own buttons? if this is a case use ValidationGroup. e.g: in tab1 assign to ValidationGroup property in your validation controls and button controls to say tab1, in tab2 assign a validationgroup property of say tab2 and so on.


the content of each tab are in a user control ... I thought that would take care of it, ... thanks for the pointer

Ajax TabControl

Hi there.

I am using a tabcontrol from the ajax control toolkit.

I have three tab panels inside a tab container.

My tab container is TabCon and the tab panels inside are tab1, tab2 and tab3.

How can I do that when for example I click (or selected) on Tab1, a code-behind, let us say Tab1_Clicked event would be triggered. For tab2, when I click on it, a code-behind named tab2_clicked would be triggered.

How would I be able to map the code behind events to the ajax tab control's tab clicked event?

Advice would be highly appreciated. Thanks.

I am kind of stuck with this problem. Any advice coming from those who have implemented something similar to this one?

I was able to create some javasript function but I cannot seem to map directly a function I have in my code behind so that when that java script invokes a postback, only that said code behind is triggered.

Your advice would be highly appreciated as usual.

Thanks.


If you just want to run some client-side (javascript) code, just add an OnClientClick attribute to each TabPanel.

If you want to execute some server-side (VB or C#) code, you need to implement a small hack:

Add a button control or button controls (depending on what you need to do) to the page. Set their style="display:none;".


Hi Plz check this thread

http://forums.asp.net/t/1196925.aspx

Thank u

Baba

Please remember to click "Mark as Answer" on this post if it helped you.


Hi BatutaBunsing,

As far as I know , neither TabContainer nor TabPanel has OnClick event(Server side event). In your situation, you should use ActiveTabChanged event.For example,

protected void TabContainer1_ActiveTabChanged(object sender, EventArgs e)
{
switch (TabContainer1.ActiveTabIndex) {
case 0: //do someting here;
break;
case 1: //do something else;
break;
default: break;
}
}

Best regards,

Jonathan


Hi Jonatahn,

Could you provide more insight on what you have stated here?

I am a bit stuck on this tab index changed for the past few days.. search came out empty or as i must say, inadequate for my need.

thanks.


Hi BatuaBunsing,

Here is a working example that you shall modify on it.

<%@. 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) { // We also can add below to TabContainer1_ActiveTabChanged(object sender, EventArgs e)
switch (TabContainer1.ActiveTabIndex) { case 0: OnTab0Selected(); break; case 1: OnTab1Selected(); break; default: break; } } private void OnTab0Selected() { } .......</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> <ajaxToolkit:TabContainer ID="TabContainer1" runat="server" AutoPostBack="true" ActiveTabIndex="1"> <ajaxToolkit:TabPanel runat="server" ID="TabPanel1"> <HeaderTemplate> TabPanel1</HeaderTemplate> <ContentTemplate> <asp:Button ID="Button1" runat="server" Text="Button" /> </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel ID="TabPanel2" runat="server"> <HeaderTemplate> TabPanel2</HeaderTemplate> <ContentTemplate> <asp:Button ID="Button2" runat="server" Text="Button" /></ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> </form></body></html>

I hope this help.

Best regards,

Jonathan

AJAX Support for TreeView - When?

I've read that you cannot implement TreeViews inside AJAX update panels. Does anyone know if or when this issue is going to be addressed? I've also tried using a TreeView not inside an update panel, but on the same page as another control inside an update panel and I've seen strange behavior from the TreeView that I don't see if I remove AJAX from the page entirely.

Thanks for your time.

TreeView and Menu are supported in update panel. may be you have a mistakes of using TreeView, or may be you have change the tree after page load!

Regards.


Is that a typo? TreeView and Menu arenot supported inside an UpdatePanel. Seehttp://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx#UpdatePanelCompatibleControls.

I'm not sure when this will change.

There should be no trouble having those controls outside the UpdatePanel (but on the same page).


Steve Marx:

Is that a typo? TreeView and Menu arenot supported inside an UpdatePanel. Seehttp://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx#UpdatePanelCompatibleControls.

I'm not sure when this will change.

There should be no trouble having those controls outside the UpdatePanel (but on the same page).

Thanks Steve of that Note. really I'm wonder of that because I'd used it before . first I think may be that in the versions before CTP .

after I'v read that link I try to use it in severl ways , sometims make a mistake inside it "not an error".

In the link up I read that :"Additionally, in some cases you can use the controls in a specific way to make them compatible with partial-page updates".

may be there a Spical case for TreeView.