Monday, March 26, 2012

Atlas UpdatePanel and Button Event

I do put the button inside UpdatePanel , i want when i click that button it will do something() , but the problem here that sometime it work and aslo sometime not work . Anyone fall into the situation the same as me ? Can u give give gor me any hint to recover this problem.

Thanks

hello.

not sure on what you mean...can you post a small example here?


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

UserControl.ascx

<%

@.ControlLanguage="C#"AutoEventWireup="true"CodeFile="UserControl.ascx.cs"Inherits="SurveyUserControl" %><atlas:UpdatePanelrunat="server"ID="UpdatePanel"> <ContentTemplate>

<

asp:ButtonID="Button"runat="server"OnClick="Button_Click"Text="Click"/>

<atlas:Panelrunat="server"ID="Panel1" >

<asp:LabelID="Label1"runat="server" tex></asp:Label>

</atlas:Panel>

<atlas:Panelrunat="server"ID="Panel2"visbile="false">

<asp:LabelID="Label2"runat="server"></asp:Label>

</atlas:Panel>

</ContentTemplate></atlas:UpdatePanel>

UserControl.ascx.cs

protected

void Button_Click(object sender,EventArgs e){

Panel1.visible = false;

Panel2.visible = true;

dosomething();

}

Default.aspx

<%

@.RegisterSrc="~/UserControl.ascx"TagName="UserControl"TagPrefix="uc1" %>

<

asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"runat="Server"><atlas:ScriptManagerID="MasterScriptManager"runat="Server"EnablePartialRendering="True"EnableScriptGlobalization="false"></atlas:ScriptManager>

<

PanelID="SurveyUserControlDnaVjfFieldSetPanel"runat="server"></Panel>

Default.aspx.cs

protected

overridevoid OnInit(EventArgs e)

{

UserControl userControl = (UserControl)Page.LoadControl("~/UserControl.ascx");

Panel.Controls.Add(userControl);

base.OnInit(e);

}

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

that is my code , I want when i click it just postback inside it not whole the Default page , but when i click the button sometime it work sometime does not .


hello.

man, this is not a working sample...what doesn't work as you expect?


Divide and conquer, my friend.

Try taking your system and try reducing it to the simplest scenario with a little test web application and getting your problem to duplicate. If you can, post it to a public site so we can see what you're talking about; if you can't, then at least post the sample code (that works) for this simple app and we'll help.

Millions of things could be causing this to "not work".


Sorry , maybe i mistake . Right now maybe i figure out in a bit .I dont know that is bug of UpdatePanel or not ? That error (it does not show the

<

divstyle="width: 100; border: solid 1 blue"><divstyle="width:<%# Eval("someval")%>; background-color: Red;"></div></div>

at the layout or it does nothing) occur only if i fire a button event at the loading time (because i do many thing on my page so it does take time for loading) . If i fire event after it is completed loading , everything is ok . Any idea to help me . I can post all the code ,beacuse it too much that why it take time for loading .

No comments:

Post a Comment