Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Monday, March 26, 2012

Atlas updatepanel triggered by user control event

I created a user control which has a imagebuttton in it, I then exposed the click event of the button to the page the user control was placed on using the following code:

Public Event ImageButton1_Click(ByVal senderAs Object,ByVal eAs EventArgs)Private Sub eventXYZ(ByVal senderAs Object,ByVal eAs System.Web.UI.ImageClickEventArgs)Handles ImageButton1.ClickRaiseEvent ImageButton1_Click(sender, e)End Sub

I can use this event from the ASPX page with no problems, however when I use the event as an Atlas trigger for the updatepanel the page always posts back. Is there any way to wire this event up to the upatepanel and avoid the postback (btw the user control was not added dynamically).

Any chance you've found a resolution to this? I'm having the same issue but with a dropdown in a user control....

Thanks.


hello.

well, not something supported out of the box...maybe this tip will help you:

http://forums.asp.net/thread/1345407.aspx

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 .

Wednesday, March 21, 2012

Atlas renders duplicated buttons...

Hi, All:

Please check the following code:

put updatePanel within a table will duplicate button and dropdownlist.

remove table tag is fine though.

Is this a bug?

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

<%@dotnet.itags.org.PageLanguage="C#" %>

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

<scriptrunat="server">

void Button1_Click(object sender,EventArgs e)

{

listMatter.Items.Clear();

listMatter.Items.Add("text1");

listMatter.Items.Add("text2");

}

</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>

<table>

<atlas:UpdatePanelID="up1"Mode="Conditional"runat="server">

<Triggers>

<atlas:ControlEventTriggerControlID="Button1"EventName="Click"/>

</Triggers>

<ContentTemplate>

<tr><td>

<asp:LinkButtonID="Button1"runat="server"OnClick="Button1_Click"Text="Button"/>

Matter:

</td>

</tr>

<tr><td>

<asp:DropDownListID="listMatter"runat="server"></asp:DropDownList>

</td></tr>

</ContentTemplate>

</atlas:UpdatePanel>

</table>

</div>

</form>

</body>

</html>

not to get too far off topic here but...
why would you create a table and then the update panel control?

is your intent to create a row that is updatable?
interesting concept if you are... (most would create a table cell and then the update panel or use divs instead)

i don't really know but i would look to see if using the "tbody" helps in any way
the reason why i say that is because there are instances that i have seen where the "tbody" must be present for some "features" to work properly in Atlas


Hi,

I think the problem is that the UpdatePanel wraps its content with a div or span tag, thus the markup for the table is like:

<table>
<div><!-- div as first child of table -->
...
</div>
</table>
and this cause problems when replacing the updated HTML using the DOM. I would place the UpdatePanel inside the cell, to wrap only the DropDownList, like meisinger suggested.

Atlas Problem,please help

i 've installed Atlas.when i try to use any extender, for ex: Button or TextBox ,and then takes the properties of Textbox or button, there comes the Option of Extender, but when i click on Plus button to extend those option, there dsnt come any other option , ie that plus dsnt expand, whats d reazn,pls help methanxIn my experience, you have to actually set the options for the extender in the source view of the page, rather than on the design surface. You may want to give that a shot.
no, i have seen a video tutorial d/l from asp.net in that video,they have not done anything in code view, just dragged the extender and from property view ,sets the option of control. but in my controls property extender name appers but not the list of options
no, i have seen a video tutorial d/l from asp.net in that video,they have not done anything in code view, just dragged the extender and from property view ,sets the option of control. but in my controls property extender name appers but not the list of options