Last post Apr 27, 2019 08:31 PM by jzero
Apr 27, 2019 02:04 AM|pvong|LINK
I'm a newbie with a newbie question. I have a test page testing the UpdatePanel. I have a Panel then UpdatePanel inside with two TextBoxes inside. TB1 has calendar extender with Postback that just puts the same date in TB2. This works perfectly with
All I want to do is have the Button postback so it will run the code behind to just put "Hello" in TB2. The button is OUTSIDE of the UpdatePanel but inside the Panel. It does nothing when I click it and I don't get my hello. What am I doing wrong?
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Panel ID="Panel1" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" BehaviorID="TextBox1_CalendarExtender" TargetControlID="TextBox1" />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
Public Class Delete
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Protected Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
TextBox2.Text = TextBox1.Text
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox2.Text = "hello"
Thanks for your help in advance from a Newbie!!!
Apr 27, 2019 11:46 AM|jzero|LINK
You have to set Triggers in your update panel.
Here you more info and sample
Apr 27, 2019 02:18 PM|pvong|LINK
Thanks and I'll read this but I thought Trigger was only for INSIDE the updatepanel. I have the Button OUTSIDE of the UpdatePanel. Thanks again and I will read this and see if I can figure it out.
Apr 27, 2019 08:31 PM|jzero|LINK
You can use any control as Trigger, it can be inside/ouside UpdatePanel, you just need to use the Proper trigger, in your case set you button as AsyncPostBackTrigger, and see.
So just read documentation closely.