Showing posts with label refresh. Show all posts
Showing posts with label refresh. Show all posts

Wednesday, March 28, 2012

UpdatePanel - DataGrid - Client Refresh

hi
I have a GridView inside a UpdatePanel


the case is: The user open a new window, select new items witch afect the data displayed in the DataGrid.

I want to update de GridView content via a Javascript method is there a way to do that?


thanks for any help

hello.

an easy way to do this is to add a dummy button and then perform a click programatically on that button. this should be enough to force the postback. you can also take a look at the postbackaction or event call the _dopostback method directly.


That Works fine
Thanks Madeira  
function RefreshGridView(){__doPostBack('Button1','');//Button.click();}

That Works fine
Thanks Luis Abreu
function RefreshGridView(){__doPostBack('Button1','');//Button.click();}

Does this only work from within the update panel?

I'm trying it from outside the panel and it is refreshing the whole page.

UpdatePanel - Javascript Refresh

hi
I have a GridView inside a UpdatePanel


the case is: The user open a new window, select new items witch afect the data displayed in the DataGrid.

I want to update de GridView content via a Javascript method is there a way to do that?


thanks for any help

I think this is possible. I've got the initial idea fromhere.
So put a hidden div into the UpdatePanel, for example:

<div style="display:none;">
<asp:Button id="btnHidden" runat="server" OnClick="btnHidden_Click" UseSubmitBehavior="false" /></div>

Then "trigger" this button in your popup window from javascript:

var refreshHelper = window.opener.document.getElementById( "btnHidden" );
refreshHelper.click( );

It works for me, but maybe there is smarter solutions than this.

hello.

well, currently you have 2 options: use the "dummy" button or use the postback action introduced by atlas.


Luis Abreu:

hello.

well, currently you have 2 options: use the "dummy" button or use the postback action introduced by atlas.

Luis (or anyone else), can you provide an example of using postback action? I'm trying to accomplish something very similar and the dummy button approach doesn't appeal to me.

-Lee


hello.

well, the dopostback action (or, if you want to use javascript, the __doPostBack method) will only work out correctly if there's a control placed inside the form which will be considered responsible for the postback.


Hi Luis,

I do have a a DropDownList that is inside the form so I that would work. I suppose I could just call the __doPostPack method, but I was hoping there would be something that was specific to ATLAS that would force the UpdatePanel to refresh.


hello again,

well, i guess that the answer is no, there isn't. and the reason is simple too: the update panel is just a delimiter that identifies a region which will be refreshed dinamically. all the partial postbacks are controlled by the pagerequestmanager object which uses the updatepanels defined on the page (normally divs or spans) to decide if it should perform a partial or a complete postback.


Ok, so what would you say would be the best way to accomplish this? It sounds as though the options are limited to the dummy button approach or explicitly calling __doPostBack.

hello again.

yep, that's it. i think that currently, there's no other option to perform that kind of operation.

Monday, March 26, 2012

updatepanel & declar. way of behavior (after refresh)

Hi guys,

please can somebody help me with this issue, I probably missed something important (and small?;-))...but what could it be?

I have problem with UpdatePanel & behavior defined by declarative way. I sent you little source code which demonstrates problem. There are 2 labels and 1 button on updatepanel. After loading page when I click first label, second label should hide (there is come error now, but minority for me...although if somebody explains me why, it would be great)...ok event is caught and something happened (I agree, nothing nice now :-))...but main problem is comming, if I first press button (which makes postback and update text of Label1) and after I click Label1 - ooups nothing happened, click behaviour of Label1 disappeared. If you have any ideas, pls divide it.

Thx and have a nice day

MilKob

<%

@dotnet.itags.org.PageLanguage="VB" %>

<!

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

<scriptrunat="server">

ProtectedSub Button1_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)

Label1.Text = Now.ToString

EndSub

</

script>

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

<headrunat="server">

<title>Untitled Page</title>

</

head>

<

body><formid="form1"runat="server"><atlas:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true"></atlas:ScriptManager><div><atlas:UpdatePanelrunat="server"ID="updpanel"Mode="Always">
<ContentTemplate>
<asp:LabelID="Label1"runat="server"Text="Label"></asp:Label><asp:ButtonID="Button1"runat="server"Text="Button"OnClick="Button1_Click"/><asp:LabelID="Label2"runat="server"Text="Label"></asp:Label></ContentTemplate></atlas:UpdatePanel></div>

<scripttype="text/xml-script">

<page xmlns:script=

"http://schemas.microsoft.com/xml-script/2005">

<components>

<control id=

"Label1" >

<behaviors>

<clickBehavior>

<click>

<setProperty target=

"Label2" property="visible" value="false" />

</click>

</clickBehavior>

</behaviors>

</control>

</components>

</page>

</script></form>

</

body>

</

html>hello.

i think that the problem is that the xml script that is sent from the server after the button click is "empty" and due to that you loose the behavior you've added on the initial page.

so, i'd suggest that you'd do what you're after with javascript.

Hi Luis,

thank you for your answer, although I little hoped there is a way which doesnt avoid declarativelly approach (I like it (maybe too much:-))), there is probably necessary to do that in javascript (which I wanted avoid...)

Thx again

Milo

Saturday, March 24, 2012

Updatepanel a fake?

Try the demo on http://atlas.asp.net/quickstart/atlas/samples/controls/UpdatePanel2_cs.aspx. Each time you hit the button a full page refresh occur. Is the updatepanel in the current state a fake?

I'm having the same experience on both the sample page and in my own test. What gives? The progress bar fires, you loose your scroll position and the back button is enabled. Sure seems like a full page refresh to me.

If you read the blog:http://www.nikhilk.net/AtlasM1.aspx, it says:

>>

<atlas:ScriptManager runat="server" id="scriptManager"EnablePartialRendering="true" />
One little attribute with lots of magic behind it. Rather than performing a real postback, we simulate a postback using the familiar XMLHTTP object (or in Atlas using the Web.Net.WebRequest class).

<<

If internally it's using XMLHTTP to call the server then you shouldn't be seeing the progress bar, loosing scroll position or having a back button enabled. My conclusion: there's a bug or UpdatePanel's ability is over-stated.


It's not a fake. Rather, it's just outdated.

If you're trying this out locally, then you have to recode few lines. For example...

Change:

<atlas:UpdatePanelrunat="server"ID="UpdatePanel1"Mode="Always">

<ContentTemplate>

<strong>

<spanstyle="text-decoration: underline">Shipping Address</span>:

</strong>

<br/>

<asp:LabelID="lblFirstLineShipping"runat="server"Font-Bold="False"></asp:Label><br/>

<asp:LabelID="lblSecondLineShipping"runat="server"></asp:Label><br/>

<asp:LabelID="lblThirdLineShipping"runat="server"></asp:Label><br/>

</ContentTemplate>

</atlas:UpdatePanel>

<asp:ButtonID="btnCopy"runat="server"Text="Same As Billing Address"OnClick="btnCopy_Click"CausesValidation="False"/>

To:

<atlas:UpdatePanelrunat="server"ID="UpdatePanel1"Mode="Always">

<ContentTemplate>

<strong>

<spanstyle="text-decoration: underline">Shipping Address</span>:

</strong>

<br/>

<asp:LabelID="lblFirstLineShipping"runat="server"Font-Bold="False"></asp:Label><br/>

<asp:LabelID="lblSecondLineShipping"runat="server"></asp:Label><br/>

<asp:LabelID="lblThirdLineShipping"runat="server"></asp:Label><br/>

<asp:ButtonID="btnCopy"runat="server"Text="Same As Billing Address"OnClick="btnCopy_Click"CausesValidation="False"/>

</ContentTemplate>

</atlas:UpdatePanel>

You could also have used <Triggers> to define this as well. Being that Atlas is a work-in-progress, it's understandable that samples may not work, but I wish someone would take care of bringing these samples up-to-date so that newbies like us can learn from them.


Sure enough, that seemed to do it. I just had to move the button and the thing being updated inside the UpdatePanel (or even in separate UpdatePanels) and it works great.

Thanks!


Yes, we haven't wuite caught up these samples. They'll be fixed up really soon :). Just to rre-iterate, the controls within a UpdatePanel will aautomatically cause an async callback but controls outside the UpdatePanel will now still perform a regular postback, unless they are tied to UpdatePanels through triggers.

Wednesday, March 21, 2012

UpdatePanel and focus

I Have a lot of textbox inside a updatepanel and when the text of one textbox changed, I refresh the values of each textbox.

The problem is that I lost the focus when the controls get the new values. I want the focus in the next control.

Set the focus by calling the SetFocus method of the ScriptManager object.


Thanks for the response.

Its works very well


Doesn't work for me when I try to set focus to a RadiobuttonList inside an updatepanel?

Updatepanel and Gridview

Hello,

I have an updatepanel, and within that I have a gridview. This is dependent on a button click event to trigger a refresh. 9 out of ten times the gridview is updated just fine; however when the grid goes over a certain size (i.e. number of records to be displayed, don't know what the cutoff is but it appears to be around 10) the gridview just never get's displayed on the screen again so it is like the panel is not updating (since I hide the gridview using javascript prior to starting the calculations on the server).

Can someone tell me why this is happening, and what I can do to fix it?

Thanks!

Jim

This question doesn't seem to involve the Toolkit, so you'll probably have better luck posting it to one of the other Atlas forums. Thanks!

Updatepanel and Gridview

Hi !

I'm trying to use Atlas for the first time and i seem to have some problem. I'm juste trying to use paging et sorting without refresh but it doesn't work. I have no error it just doesn't do anything. Here is my code:

<asp:ContentID="Content1"ContentPlaceHolderID="Contenu"Runat="Server">

<atlas:ScriptManagerID="sc2"EnablePartialRendering="true"runat="server"/>

<atlas:UpdatePanelID="p1"runat="server">

<ContentTemplate>

<asp:GridViewID="GridView1"runat="server"AllowPaging="True"AllowSorting="True"

AutoGenerateColumns="False"DataKeyNames="RéfIndis"DataSourceID="dsTest">

<Columns>

<asp:BoundFieldDataField="RéfIndis"HeaderText="RéfIndis"InsertVisible="False"

ReadOnly="True"SortExpression="RéfIndis"/>

<asp:BoundFieldDataField="RéfPosteDeCharge"HeaderText="RéfPosteDeCharge"

SortExpression="RéfPosteDeCharge"/>

<asp:BoundFieldDataField="RéfMachine"HeaderText="RéfMachine"SortExpression="RéfMachine"/>

<asp:BoundFieldDataField="DateDébut"HeaderText="DateDébut"SortExpression="DateDébut"/>

<asp:BoundFieldDataField="DateFin"HeaderText="DateFin"SortExpression="DateFin"/>

<asp:BoundFieldDataField="Motif"HeaderText="Motif"SortExpression="Motif"/>

</Columns>

</asp:GridView>

<asp:SqlDataSourceID="dsTest"runat="server"ConnectionString="<%$ ConnectionStrings:OrchestraCI2K %>"

SelectCommand="SELECT [RéfIndis], [RéfPosteDeCharge], [RéfMachine], [DateDébut], [DateFin], [Motif] FROM [Indisponibilités Machines]">

</asp:SqlDataSource>

</ContentTemplate>

</atlas:UpdatePanel>

</asp:Content>

Did i do some mistakes?

Thanks!!!

It looks okay. When you say that it's not working, do you mean that it's still posting back (with flicker) or something else? Also, I noticed that you're using MasterPage. Did you perhaps do something special in the MasterPage (like using the Atlas features there too)? I tried a simple example and everything works fine, including when used with MasterPage.

Same with me. I got the same error with my gridview. No flicker, no error, no result. Can somebody can post code for gridview and atlas that works on his/her app?

Thank you!


this works for me...

<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</atlas:ScriptManager>
<atlas:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<img src="http://pics.10026.com/?src=gfx/indicator.gif" />
Loading...
</ProgressTemplate>
</atlas:UpdateProgress>
<atlas:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<atlas:ControlEventTrigger ControlID="gridUsers"EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<asp:Panel Width="268px" Height="240px" runat="server" ID="pnlUsers"ScrollBars="Vertical">
<asp:GridView ID="gridUsers" runat="server"AutoGenerateColumns="False" ShowHeader="False"
Width="248px" BorderStyle="None" Height="15px"EditRowStyle-ForeColor="Gray" OnRowDataBound="gridUsers_RowDataBound"OnSelectedIndexChanged="gridUsers_SelectedIndexChanged"OnRowCommand="gridUsers_RowCommand" >
<SelectedRowStyle Font-Bold="true" />
<Columns>
<asp:TemplateField>
<ItemStyle BackColor="#E0E0E0" BorderColor="White"BorderStyle="Solid" BorderWidth="2px"
Height="23px" HorizontalAlign="Left" VerticalAlign="Middle"Width="125px" />
<ItemTemplate>
<asp:LinkButton ID="linkUserSelect" runat="server"CausesValidation="False" CommandName="Select" CommandArgument='<%#Eval("idUser") %>'
OnClick="linkUserSelect_OnClick" ForeColor="#696969"Font-Underline="false" Text='<%# Bind("chrName")%>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="EE">
<ItemStyle Height="23px" Width="35px" VerticalAlign="Middle"HorizontalAlign="Center" BackColor="#E0E0E0" BorderStyle="Solid"BorderColor="White" BorderWidth="2px" />
</asp:BoundField>
<asp:BoundField DataField="Recd">
<ItemStyle Height="23px" Width="35px" HorizontalAlign="Center"BackColor="#E0E0E0" BorderStyle="Solid" BorderColor="White"BorderWidth="2px" />
</asp:BoundField>
<asp:TemplateField>
<ItemStyle Width="45px" Height="23px" VerticalAlign="Middle"HorizontalAlign="Center" BackColor="White" BorderStyle="None" />
<ItemTemplate>
<asp:ImageButton ID="imgActivate" runat="server" Width="45px"Height="23px" CommandName="Select"
CommandArgument='<%# Eval("idUser") %>' AlternateText='<%#Eval("Act") %>' ToolTip="Activate" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EditRowStyle ForeColor="Gray" />
</asp:GridView>
</asp:Panel>
</div>
<span style=" text-align: right;"></span>
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Content

for me not :( Could you have a look to my code and tell me what is wrong, please?

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</atlas:ScriptManager>
<atlas:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>

</ProgressTemplate>
</atlas:UpdateProgress>
<atlas:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<atlas:ControlEventTrigger ControlID="GridView1" EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>


<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="SqlDataSource1"
EmptyDataText="">
<Columns>
<asp:CommandField ShowEditButton="True" ShowSelectButton="True" />
<asp:BoundField DataField="ProductID" HeaderText="Product ID" ReadOnly="True" SortExpression="ProductID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />

</Columns>
</asp:GridView>

</ContentTemplate>
</atlas:UpdatePanel>
... cut code from the select statmenet
</asp:Content>


jcasp wrote:

It looks okay. When you say that it's not working, do you mean that it's still posting back (with flicker) or something else? Also, I noticed that you're using MasterPage. Did you perhaps do something special in the MasterPage (like using the Atlas features there too)? I tried a simple example and everything works fine, including when used with MasterPage.

Thank for youy reply! When i say that it's not working i mean that when i click on the header to sort a column or when i click in the number of the page to change the page of my gridview nothing occur. No post-back, no flickering. I will try to do the same page without my masterpage. I dont think this is the problem but i'm using callback in this master page so maybe it could be the problem.


Ok i've try to do the same this but this time without my masterpage and this is working. So the problem is my masterpage. In this masterpage i'm using callback. The users can start some fonctions that generate reports and when this occurs i'm using callback to display a progress bar at the bottom of all my page and for all the users. If i'm already using callback and i want to use Atlas did i have to change something in my code or if it should work without i change something?

Thank and sorry about my bad english ^_^


<trigger> missingSianspheric .

Uffy wrote:

<trigger> missingSianspheric .

<trigger> is not required if the control is enclosed within <UpdatePanel>.

Sianspheric wrote:

Ok i've try to do the same this but this time without my masterpage and this is working. So the problem is my masterpage. In this masterpage i'm using callback. The users can start some fonctions that generate reports and when this occurs i'm using callback to display a progress bar at the bottom of all my page and for all the users. If i'm already using callback and i want to use Atlas did i have to change something in my code or if it should work without i change something?

Thank and sorry about my bad english ^_^

See if you can change your MasterPage's callback processing to Atlas-based on as well.

jcasp wrote:

Uffy wrote:

<trigger> missingSianspheric .

<trigger> is not required if the control is enclosed within <UpdatePanel>.

Could you backup your statement with source please. It will help newbies like me to understand things better.

My reasons come from:

http://west-wind.com/weblog/posts/4719.aspx

And

http://weblogs.asp.net/atlas/archive/2006/02/08/437758.aspx

And

http://www.dotnetslackers.com/Atlas/re-23004_ATLAS_UpdatePanel_Experiments.aspx

I did not see any example without <triggers> - am I missing something?

Thanks.


I want to make templet for GridView.In which each cell contain updatepanel control.Whenevery i add new row or column that newly add cell also having that updatepanel. How to do this...