Showing posts with label trigger. Show all posts
Showing posts with label trigger. Show all posts

Wednesday, March 28, 2012

Update Trigger and GridView problem

Hi!

I have an Accordion on my page. In one AccordionPane, i have an UpdatePanel containing a GridView and a button under. When i try to access my gridview in the code-behind, i encounter a problem. The trigger of my button doesn't work, the method associated with my button isn't called. If i click a second time and the button, it postback my page and i lose all the data and the page. if i click a third time, the trigger associated with the button finally works.

I only get this problem when i try to access my GridView in my page.

I add my code and underlined the line which causes the problem, i remove it everythin works fine

aspx file:

<asp:UpdatePanelID="UpdatePanelGridStartSecurities"runat="server"UpdateMode="Conditional"ChildrenAsTriggers="false">

<ContentTemplate>

<divclass="ContentPaneDetails">

<%-- GridView : Supports de depart--%>

<divclass="ContentPaneElement">

<asp:GridViewID="GridViewGainOption_StartSecurities"runat="server"AutoGenerateColumns="false"BackColor="White"

BorderStyle="None">

<Columns>

<%-- Inclure --%>

<asp:TemplateField>

<HeaderTemplate>

<labelid="LbGainOption_Include">

Include

</label>

</HeaderTemplate>

<HeaderStyleBackColor="#D5DAE0"BorderStyle="None"/>

<ItemTemplate>

<asp:RadioButtonID="GainOption_Include"runat="server"BackColor="ActiveCaptionText"GroupName="IncludeExclude"

Checked='<%# ((bool)DataBinder.Eval(Container.DataItem, "IsExcluded"))?false:true %>'/>

</ItemTemplate>

<ItemStyleBorderColor="Black"BorderWidth="1px"HorizontalAlign="Center"/>

</asp:TemplateField>

<%-- Exclure --%>

<asp:TemplateField>

<HeaderTemplate>

<labelid="LbGainOption_Exclude">

Exclude

</label>

</HeaderTemplate>

<HeaderStyleBackColor="#D5DAE0"BorderStyle="None"/>

<ItemTemplate>

<asp:RadioButtonID="GainOption_Exclude"runat="server"BackColor="ActiveCaptionText"GroupName="IncludeExclude"

Checked='<%# DataBinder.Eval(Container.DataItem, "IsExcluded") %>'/>

</ItemTemplate>

<ItemStyleBorderColor="Black"BorderWidth="1px"HorizontalAlign="Center"/>

</asp:TemplateField>

<%-- Valeur mobilière --%>

<asp:TemplateField>

<HeaderTemplate>

<labelid="LbGainOption_SecurityName">

Valeur mobilière

</label>

</HeaderTemplate>

<HeaderStyleBackColor="#D5DAE0"BorderStyle="None"/>

<ItemTemplate>

<asp:TextBoxID="GainOption_SecurityName"runat="server"BorderStyle="None"Text='<%# GetSecurityName(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "SecurityId"))) %>'></asp:TextBox>

</ItemTemplate>

<ItemStyleBorderColor="Black"BorderWidth="1px"/>

</asp:TemplateField>

<%-- Isin Code --%>

<asp:TemplateField>

<HeaderTemplate>

<labelid="GainOption_IsinCode">

Isin

</label>

</HeaderTemplate>

<HeaderStyleBackColor="#D5DAE0"BorderStyle="None"/>

<ItemTemplate>

<asp:TextBoxID="GainOption_IsinCode"runat="server"BorderStyle="None"Text='<%# GetIsinCode(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "SecurityId"))) %>'></asp:TextBox>

</ItemTemplate>

<ItemStyleBorderColor="Black"BorderWidth="1px"/>

</asp:TemplateField>

<%-- Seuil --%>

<asp:TemplateField>

<HeaderTemplate>

<labelid="LbGainOption_Threshold">

Seuil %

</label>

</HeaderTemplate>

<HeaderStyleBackColor="#D5DAE0"BorderStyle="None"/>

<ItemTemplate>

<asp:TextBoxID="GainOption_Threshold"runat="server"BorderStyle="None"Text='<%# DataBinder.Eval(Container.DataItem, "TriggerringThreshold") %>'></asp:TextBox>

</ItemTemplate>

<ItemStyleBorderColor="Black"BorderWidth="1px"/>

</asp:TemplateField>

<%-- Supprimer --%>

<asp:TemplateField>

<HeaderTemplate>

</HeaderTemplate>

<HeaderStyleBackColor="#D5DAE0"BorderStyle="None"/>

<ItemTemplate>

<asp:LinkButtonID="GainOption_Delete"runat="server"CommandName="Delete">Supprimer</asp:LinkButton>

</ItemTemplate>

<ItemStyleBackColor="#D5DAE0"BorderStyle="None"/>

</asp:TemplateField>

</Columns>

</asp:GridView>

</div>

</div>

<divclass="ContentPaneDetails">

<divclass="ContentPaneElement">

<%-- Ajouter un nouveau support de départ --%>

<asp:LinkButtonID="GainOption_AddStartSecurity"runat="server"Text="Ajouter une valeur"OnClick="GainOption_AddStartSecurity_Click">

</asp:LinkButton>

<br/>

<%-- Nom du support --%>

<asp:LabelID="LbGainOption_StartSecurityName"runat="server"Visible="false"Text="Valeur moblière :"></asp:Label>

<asp:TextBoxID="GainOption_StartSecurityName"runat="server"Visible="false"></asp:TextBox>

<asp:ImageButtonID="ImgGainOption_StartSecurityName"runat="server"ImageUrl="~/Images/Directory.gif"Visible="false"/>

<ajaxToolkit:AutoCompleteExtenderID="AutoCompleteGainOption_StartSecurityName"runat="server"TargetControlID="GainOption_StartSecurityName"

ServicePath="WebServices/AutoComplete.asmx"ServiceMethod="GetSecuritiesListByLongName"CompletionSetCount="3"MinimumPrefixLength="3"

CompletionListCssClass="autocomplete_completionListElement"CompletionListItemCssClass="autocomplete_listItem"

CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"UseKeyValuePairs="true"

KeyHiddenFieldID="HiddenModify_SecurityId">

</ajaxToolkit:AutoCompleteExtender>

<%-- Isin du support --%>

<asp:LabelID="LbGainOption_StartIsinCode"runat="server"Visible="false"Text="Isin : "></asp:Label>

<asp:TextBoxID="GainOption_StartIsinCode"runat="server"Visible="false"></asp:TextBox>

<asp:ImageButtonID="ImgGainOption_StartIsinCode"runat="server"ImageUrl="~/Images/Directory.gif"Visible="false"/>

<ajaxToolkit:AutoCompleteExtenderID="AutoCompleteGainOption_StartIsinCode"runat="server"TargetControlID="GainOption_StartIsinCode"

ServicePath="WebServices/AutoComplete.asmx"ServiceMethod="GetSecuritiesListByIsinCode"CompletionSetCount="3"MinimumPrefixLength="3"

CompletionListCssClass="autocomplete_completionListElement"CompletionListItemCssClass="autocomplete_listItem"

CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"UseKeyValuePairs="true"

KeyHiddenFieldID="HiddenModify_SecurityId">

</ajaxToolkit:AutoCompleteExtender>

<%-- Seuil du support --%>

<asp:LabelID="LbGainOption_StartThreshold"runat="server"Visible="false"Text="Seuil : "></asp:Label>

<asp:TextBoxID="GainOption_StartThreshold"runat="server"Visible="false"></asp:TextBox>

<%-- Insert --%>

<asp:LinkButtonID="InsertGainOption_StartSecurity"runat="server"Visible="false"Text="Insert"OnClick="InsertFromSecurity_Click"></asp:LinkButton>

</div>

<divclass="Clear">

</div>

</div>

</ContentTemplate>

<Triggers>

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

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

</Triggers>

</asp:UpdatePanel>

cs file:

protectedvoid Page_Load(object sender,EventArgs e)

{

if (IsPostBack ==false)

{

HiddenModify_NavigationMode.Value ="1";

//HiddenModify_NavigationMode.Value = "2";

//HiddenModify_MonitoringMandateId.Value = "7";

LogicMonitoringMandates monitorings =LogicMonitoringMandates.getInstance();

LogicGainMandateOptions gainOptions =LogicGainMandateOptions.getInstance();

LogicLossMandateOptions lossOptions =LogicLossMandateOptions.getInstance();

LogicSellMandateOptionDetails sellDetails =LogicSellMandateOptionDetails.getInstance();

LogicBuyMandateOptionDetails buyDetails =LogicBuyMandateOptionDetails.getInstance();

LogicPortfolios portfolios =LogicPortfolios.getInstance();

LogicSecurities securities =LogicSecurities.getInstance();

LogicPortfolioPositions positions =LogicPortfolioPositions.getInstance();

LogicPortfolioPositionDetails details =LogicPortfolioPositionDetails.getInstance();

securities.GetSecurities();

if (HiddenModify_NavigationMode.Value =="1")

{

/*

RadioButton gainOption_AutomaticPerimeter = (RadioButton)AccordionPaneGainOption.FindControl("GainOption_AutomaticPerimeter");

RadioButton gainOption_00007Threshold = (RadioButton)AccordionPaneGainOption.FindControl("GainOption_00007Threshold");

gainOption_AutomaticPerimeter.Checked = true;

gainOption_00007Threshold.Checked = true;

*/

}

if (HiddenModify_NavigationMode.Value =="2")

{

int l_intMonitoringMandateId =Convert.ToInt32(HiddenModify_MonitoringMandateId.Value);

monitorings.GetMonitoringMandateByMonitoringMandateId(l_intMonitoringMandateId);

gainOptions.GetMandateOptionsByMonitoringMandateId(l_intMonitoringMandateId);

HiddenModify_GainMandateOptionId.Value =Convert.ToString(gainOptions.GetMandateOptionFromIndex(0).MandateOptionId);

GridView gridViewGainOption_StartSecurities = (GridView)AccordionPaneGainOption.FindControl("GridViewGainOption_StartSecurities");

The problem comes if I add the line above

//sellDetails.GetMandateOptionDetailsByMandateOptionId(Convert.ToInt32(HiddenModify_GainMandateOptionId.Value));

//gridViewGainOption_StartSecurities.DataSource = sellDetails.TABLE;

//gridViewGainOption_StartSecurities.DataBind();

AccordionPaneSignaletique_DataBind();

AccordionPaneGainOption_DataBind();

}

}

}

Does anyone know what i can do? Can i add the trigger of the updatePanel in the code behind in the pageload method ?

Thanks in advance,

I've been looking for this problem for all my weekend and i found what was the problem!!!!!!!

The problem comes from the Accordion component, during the Page_Load, the Accordion and the child component doesn't exists, but in my case i didn't get any error of "not found controls".

I found a fix on this page :

http://couldbedone.blogspot.com/2007/07/what-wrong-with-accordion-control.html

Thanks a lot to this guy!

i just added Accordion.FindControl("nothing") on a Page_Init and it works great now!

Update trigger in AccordianPane - How to find Control

Hi, I have an accordian with 3 panes. I have buttons and controls in those panes. One of these buttons is used to update an UpdatePanel. I have tried setting theAsyncPostBackTriggerEventName="Click"ControlID="SearchButton", but because the button is in a Accordian it has a different id ID assume.

How can i assign this in the code? What would my findControl() need to be? I get ErrorObject reference not set to an instance of an object.

I have been trying stuff like :

Dim SearchBtnAsNew AsyncPostBackTrigger

SearchBtn.ControlID =Me.FindControl("MyAccordion").FindControl("AccordionPane1").FindControl("SearchButton").ClientID.ToString

MsgBox(Me.FindControl("MyAccordion").FindControl("AccordionPane1").FindControl("SearchButton").ClientID.ToString)

SearchBtn.EventName ="Click"

Me.gridViewUpdate.Triggers.Add(SearchBtn)

You are on the right path, but you are going about it all wrong. You are getting the Error because anytime you use FindControl, you need to cast it to a particular object type:

ProtectedSub Page_PreRender(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.PreRender

Dim SearchButtonAs Button
SearchButton =CType(MyAccordion.FindControl("AccordionPane1").FindControl("Button1"), Button)

Dim TrggrAsNew AsyncPostBackTrigger
Trggr.ControlID = SearchButton.UniqueID'UniqueID, not ClientID.
Trggr.EventName ="Click"
gridViewUpdate.Triggers.Add(Trggr)

EndSub


Yep that sorted it, Thanks a bunch DisturbedBudda

UpdatePanel - "Unknown Error"

I am using a drop down to fire the trigger on an update panel

This is my code:

<Triggers>
<atlas:ControlEventTrigger ControlID="DDLCountryID" EventName="TextChanged" />
</Triggers>

When I click on the drop down, I get "Unknown Error".

Your help is appreciated.

Hi,

which release of ASP.NET AJAX are you using?

In the RC, you should choose between a PostBackTrigger or an AsyncPostBackTrigger.

Monday, March 26, 2012

UpdatePanel + DataList (not updating)

I have a DataList inside of an UpdatePanel, with an update trigger from a drop down list. The DataList is data bound to a IDataReader upon postback. I'm not getting an update. When I remove the UpdatePanel, things work as expected. Here's the code:

<asp:Panel ID="pnlFilters" runat="server" style='margin: 0px auto 0px auto;text-align: center;'>
<asp:Label ID="lblProducts" runat="server" Text="Rovion Products:" />
<asp:DropDownList ID="ddlProducts" runat="server" style='margin-right: 50px;' OnSelectedIndexChanged='ddl_SelectedIndexChanged' AutoPostBack='true' />
<asp:Label ID="lblCategories" runat="server" Text="Vertical Categories:" />
<asp:DropDownList ID="ddlCategories" runat="server" OnSelectedIndexChanged="ddl_SelectedIndexChanged" AutoPostBack="true" />
</asp:Panel>
<br />
<br />
<atlas:UpdatePanel ID="upDemos" runat="server">
<ContentTemplate>
<atlas:UpdateProgress ID="uppDemos" runat="server">
<ProgressTemplate>
<asp:Panel id="pnlLoader" runat="server" style='margin: 0px auto 0px auto;text-align: center;'>
<asp:Image ID="imgLoader" runat="server" ImageUrl="~/Images/ajax-loader.gif" />
</asp:Panel>
<br />
</ProgressTemplate>
</atlas:UpdateProgress>
<asp:DataList ID="dlDemos" runat="server" CellPadding="10" GridLines="None" RepeatColumns="3" ShowFooter="False" ShowHeader="False" BorderColor="#89a3b2" BorderWidth="2px" style='margin: 0px auto 0px auto;text-align: center;'>
<ItemTemplate>
<asp:HyperLink ID="hlThumbnail" runat="server" ImageUrl='<%# Eval("ThumbnailURL") %>' NavigateUrl='<%# GetNavigateUrl() %>' Target="_new" />
<br />
<br />
<b>Title:</b> <%# Eval("Title") %>
<br />
<b>Product:</b> <%# Eval("ProductName") %>
<br />
<b>Vertical:</b> <%# Eval("CategoryName") %>
</ItemTemplate>
</asp:DataList>
</ContentTemplate>
<Triggers>
<atlas:ControlValueTrigger ControlID="ddlCategories" PropertyName="SelectedValue" />
<atlas:ControlValueTrigger ControlID="ddlProducts" PropertyName="SelectedValue" />
</Triggers>
</atlas:UpdatePanel>

Any suggestions? Thanks! :-)

I really need some advice on this problem. I have a ScriptManager w/ partial rendering enabled. What happens is the UpdateProgress graphic will show up when I change the selection of the drop down list (like it's posting back), but 1) the UpdateProgress never goes away, and 2) the DataList is never updated...so everything in the UpdatePanel is not being updated, and I don't know why :-(

Does anyone have a clue why this would be occurring? Thanks for your time!


Hi~This might be the explanation of your problem. You may try event trigger other than value trigger, e.g

<atlas:ControlEventTriggerControlID="ddlCategories"EventName="SelectedIndexChanged"/>

Saturday, March 24, 2012

UpdatePanel and "foreign" characters

Hi!

I'm using an UpdatePanel with a DataList inside and a Trigger that updates the panel.

In Explorer no updates are shown if the datalist contains swedish characters ( ?, ? or ?), the trigger works but the "old" content is still shown. This works perfectly fine in FireFox.

Any suggestions?

/Jovan

I tried to simulate this and it appears to be working okay. What I did was have both FormView and DataList for a table within the same UpdatePanel. I've also handled the ItemUpdated event for the FormView and invoked DataList.DataBind() method to refresh the DataList content. Using your swedish characters for one of the FormView updates, it gets reflected to the DataList. I'm using IE version 6.0.

UpdatePanel and Asynch trigger gives an error

I have 2 Update Panels "ajaxIssueSummary","ajaxCCPack".
"ajaxIssueSummary" contains a gridview "dgIssueSummary" which contains a DropDownlist "ddlIssueState" as a template field.
"ajaxCCPack" contains a gridview "dgCCPack".

<ajaxExt:UpdatePanel UpdateMode="Conditional" ID="ajaxIssueSummary" runat="server">
<ContentTemplate>

<asp:GridView ID="dgIssueSummary"
runat="server"
AutoGenerateColumns="False"
DataKeyNames="pkIssueTracker"
CellPadding="4"
ForeColor="#333333"
GridLines="Vertical"
SkinID="Fun"
Width="900px"
OnRowCreated="dgIssueSummary_RowCreated" >
<Columns>
<asp:BoundField DataField="pkCustomRule" HeaderText="pkCustomRule" InsertVisible="False"
ReadOnly="True" SortExpression="pkCustomRule" Visible="False" />
<asp:BoundField DataField="fkQuestionnaireField" HeaderText="fkQuestionnaireField"
SortExpression="fkQuestionnaireField" Visible="False" />
<asp:BoundField DataField="sInternalMessage" HeaderText="Internal Message" SortExpression="sInternalMessage" >
<ItemStyle Width="300px" />
</asp:BoundField>
<asp:BoundField DataField="sExternalMessage" HeaderText="External Message" SortExpression="sExternalMessage" >
<ItemStyle Width="300px" />
</asp:BoundField>
<asp:TemplateField SortExpression="sFriendlyName" Visible="False">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("sFriendlyName") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblFriendlyName" runat="server" Text='<%# Bind("sFriendlyName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="pkIssueTracker" InsertVisible="False" SortExpression="pkIssueTracker" Visible="False">
<ItemTemplate>
<asp:Literal ID="lblpkIssueTracker" runat="server" Text='<%# Bind("pkIssueTracker") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:DropDownList ID="ddlIssueState" Runat="server" DataSourceID="IssuesStateDS" DataTextField="sIssueState" DataValueField="pkIssueState" SelectedValue='<%# Eval("pkIssueState") %>' AutoPostBack="true" OnSelectedIndexChanged="ddlIssueState_SelectedIndexChanged" >
</asp:DropDownList>
<asp:SqlDataSource ID="IssuesStateDS" runat="server" ConnectionString="<%$ ConnectionStrings:BritneyQuestionnaireDataConnectionString %>"
SelectCommand="SELECT [pkIssueState], [sIssueState] FROM [IssueState] WHERE pkIssueState in (1,3,6)"></asp:SqlDataSource>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>

</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<ajaxExt:AsyncPostBackTrigger ControlID="btnOrderGo" EventName="Click" />
<ajaxExt:AsyncPostBackTrigger ControlID="ddlDocument" EventName="SelectedIndexChanged" />
<ajaxExt:AsyncPostBackTrigger ControlID="btnUpdateAnswerBank" EventName="Click" />
</Triggers>
</ajaxExt:UpdatePanel>

<ajaxExt:UpdatePanel UpdateMode="Conditional" ID="ajaxCCPack" runat="server">
<ContentTemplate>

<asp:GridView ID="dgCCPack" runat="server" AutoGenerateColumns="False" AutoGenerateEditButton="True"
OnRowEditing="dgCCPack_RowEditing"
CellPadding="4"
ForeColor="#333333"
GridLines="Vertical"
OnRowCancelingEdit="dgCCPack_RowCancelingEdit"
OnRowUpdating="dgCCPack_RowUpdating"
SkinID="Fun" Width="900px">
<Columns>
<asp:TemplateField HeaderText="pkIssueTracker" InsertVisible="False" SortExpression="pkIssueTracker"
Visible="False">
<ItemTemplate>
<asp:Label ID="lblpkIssueTracker" runat="server" Text='<%# Bind("pkIssueTracker") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Internal Message" SortExpression="sInternalMessage">
<EditItemTemplate>
<asp:TextBox ID="ccEditInternalMessage" runat="server" Text='<%# Bind("sInternalMessage") %>' Width="300"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="ccInternalMessage" runat="server" Text='<%# Bind("sInternalMessage") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="300px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="External Message" SortExpression="sExternalMessage">
<EditItemTemplate>
<asp:TextBox ID="ccEditExternalMessage" runat="server" Text='<%# Bind("sExternalMessage") %>' Width="300" ></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="ccExternalMessage" runat="server" Text='<%# Bind("sExternalMessage") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="300px" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</ContentTemplate>
</ajaxExt:UpdatePanel>

***************************************************************
The task is: when "ddlIssueState" selected index changes I need to refresh "dgCCPack".
So this is what I did :

protected void dgIssueSummary_RowCreated(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList ddl = (DropDownList)e.Row.Cells[6].FindControl("ddlIssueState");
Microsoft.Web.UI.AsyncPostBackTrigger trigger = new Microsoft.Web.UI.AsyncPostBackTrigger();
trigger.ControlID = ddl.UniqueID.ToString();
trigger.EventName = "SelectedIndexChanged";
ajaxCCPack.Triggers.Add(trigger);
}
}
catch (Exception ex)
{
throw ex;
}
}

But I am getting the following error :
A control with ID 'ddlIssueState' could not be found for the trigger in UpdatePanel 'ajaxCCPack'.

Please suggest the right way of doing this

You can not trigger the?asynchronous?postback events of?the asp:DropDownList named "ddlIssueState" which?is?in?the?"ajaxIssueSummary"?
UpdatePanel?from?another?UpdatePanel?called?"ajaxCCPack".
Here is a solution for you to solve the issues.
Place two asp:GridViews in the same asp:UpdatePanel and set?asp:PostBackTrigger?to?asp:GridView?named?"dgIssueSummary" through the triggers of the asp:Updatepanel named "ajaxIssueSummary".When?the?SelectedIndexChanged?event?of?the?asp:DropDownList?named?
"ddlIssueState"?happens, try?to?trigger?the?second?asp:GridView?named?"dgCCPack".It?should?work?fine.
Wish this can help you.

UpdatePanel and client-side triggers?

Is there any way to trigger an ajax postback by a client-side event, like the keyup-event on a textfield?

pnp:

Is there any way to trigger an ajax postback by a client-side event, like the keyup-event on a textfield?

What I mean is, all the examples I have seen so far all uses the click method of the button control as the trigger. Is it possible to use any other control and/or event, or am I limited to use the "native" postback/submit controls?


Any event can trigger a partial postback, if it originates from a control that is an AsyncPostbackTrigger of the panel. It doesn't have to be a button or click. For example, the selected index changing on a dropdown that has AutoPostBack set to true.

Additionally, you canprogrammatically call an update using JavaScript on the client side.


Thank you - this was exactly what I was looking for ;-)

UpdatePanel and back button

Hi,

I have an asp.net page with an UpdatePanel on it that has a trigger on an image button. The image button alters the update panel to a slightly different state. I have an issue that happens if the user interacts with the update panel, then navigates away from the page and finally returns to the page with the back button on the browser. At this point the page is rendered as it originally appeared (before the update panel was interacted with, and I'm OK with that), but if the user now clicks the image button the update panel does not get processed.

The page load even fires but the image button's on click even doesn't fire. I assume this is because asp.net has figured out that the request is invalid or expired or whatever. My problem is detecting this condition and handling it.

Does anybody have any suggestions?


Hi!,

Have a look at the new History server control found in the ASP.NET Futures (May 2007) package: http://quickstarts.asp.net/Futures/ajax/doc/history.aspx

You need to install the package, but it may help in your situation,

Cheers,



Thanks for the reply Rasetti.

Yes, I saw the history server control however it didn't seem to apply to my condition. I am not trying to save the update panel's state in the history. I am fine with it reverting to its original state if the user presses the back button in the browser. My issue is that once the user does that and tries to click on the update panel's image button trigger, the update panel's on click event does not fire so the update panel gets rendered "empty". I have traced this through and the page load event fires however asp.net must be detecting that the request is not valid in some way and never fires the on click event for the image button.


UpdatePanel and Exceptions

Hi

I have an UpdatePanel using a trigger from the click event on a button. Everything seems to works ok, the click event hits the code-behind. My question is, how do you tell the page that an exception occured in the code-behind?

Many thanks

Craig

Hi,

you can use the ErrorTemplate provided by the ScriptManager control:

<ErrorTemplate>
<div>
There was an error processing your action. <br />
<span id="errorMessageLabel"></span>
<hr />
<button type="button" id="okButton">OK</button>
</div>
</ErrorTemplate>

This way, all the controls on the page will be disabled and the Exception message will be displayed in a nice overlay. You can customize the appearance of the ErrorTemplate but notice that the ids in red are "hard-coded-ids". The first is a label that displays the error message, the second is a button that re-enables the page.

Moreover, you can catch the PageError event of the ScriptManager control:

<atlas:ScriptManager ID="ScriptManager1" runat="server"
EnablePartialRendering="true"
OnPageError="ScriptManager1_PageError">

and, in codebehind, declare an event handler in which you can do custom processing of the error message:

protected void ScriptManager1_PageError(object sender, PageErrorEventArgs e)
{
e.ErrorMessage = "Unable to complete the request because: "
+ "<strong>"
+ e.Error.Message
+ "</strong>";
}

The PageErrorEventArgs instance exposes two properties:ErrorMessage that can be set to the error message that the client will receive;Error that returns a reference to the Exception instance.

Hi Garbin

My script manager is in a MasterPage:

<atlas:ScriptManagerID="scriptmanager"runat="Server"EnablePartialRendering="true"/>


How can I access the<ErrorTemplate> or the PageError event from the MasterPage in my aspx page which uses:

<atlas:ScriptManagerProxyID="scriptManager"runat="server"EnableScriptComponents="false">

I have a user control which renders a nice messagebox, so to be consistant I'd want to use that.

Thanks for your help.

Craig


Hi,

you cannot add an ErrorTemplate to the ScriptManagerProxy, but only to the ScriptManager control. But to preserve consistency it seems to me a good idea to have an ErrorTemplate in a MasterPage.

You can also drop in the ErrorTemplate a UserControl, just ensure that the ScriptManager is located inside the <form />. One problem however is that, as you know, the UserControl modifies the ClientID of its child controls and the ScriptManager relies on two hard-coded ids ("errorMessageLabel" and "okButton") to work as expected. One solution would be to assign these ids to non-server controls.

Wednesday, March 21, 2012

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

I have a GridView in an UpdatePanel with a trigger for a button that toggles whether or not the GridView is visible. My problem is that the buttons within the GridView like edit, delete, etc. don't perform the standard functionality. So now when I click these buttons the page breaks because Atlas is trying to do inline editing and that biz. Is there anyway to have the UpdatePanel ignore these commands?

Well, it can't be done. Turns out the closes thing to accomplishing this at the moment is to set the postbackurl of the item to the current page. That is of cousre if the items have a postbackurl property.

This is something that the Atlas developers really need to build in . . .