Welcome Guest Search | Active Topics | Sign In | Register

callbackpanel with textbox? Options
Bottom Line Gurus
Posted: Friday, October 8, 2010 4:17:54 PM
Rank: Newbie
Groups: Member

Joined: 10/8/2010
Posts: 3
Good day:
I have several textboxes (20+) that I need to refresh when lost focus without refresh the whole screen. How can I make it work?

Screen:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="callback.aspx.vb" Inherits="callback" %>

<%@ Register assembly="EO.Web" namespace="EO.Web" tagprefix="eo" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Página sin título</title>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
<eo:CallbackPanel ID="CallbackPanel1" runat="server" Height="110px"
Triggers="{ControlID:TextBox1;Parameter:},{ControlID:TextBox2;Parameter:},{ControlID:TextBox3;Parameter:},{ControlID:TextBox4;Parameter:},{ControlID:RadioButton1;Parameter:},{ControlID:RadioButton2;Parameter:},{ControlID:__Page;Parameter:}"
Width="200px">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</eo:CallbackPanel>
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="a" Text="test 0" />
<br />
<asp:RadioButton ID="RadioButton2" runat="server" GroupName="a" Text="test 1" />
<br />
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</form>
</body>
</html>

Code:

Partial Class callback
Inherits System.Web.UI.Page


Protected Sub CallbackPanel1_Execute(ByVal sender As Object, ByVal e As EO.Web.CallbackEventArgs) Handles CallbackPanel1.Execute

If RadioButton1.Checked Then
TextBox1.Text = TimeOfDay
TextBox2.Text = "aaa"
TextBox3.Text = "sss"
End If
If RadioButton2.Checked Then
TextBox1.Text = TimeOfDay
TextBox2.Text = "bbb"
TextBox3.Text = "zzz"
End If

End Sub

Protected Sub TextBox4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
CallbackPanel1_Execute(sender, e) ' wrong guess
End Sub
End Class
'The radiobuttons works fine. The textboxes doesnt
'I dont want to autopostback to refresh the whole screen, just the panel

TIA;
eo_support
Posted: Friday, October 8, 2010 4:59:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You don't need to handle CallbackPanel_Execute event and TextBox4_TextChanged event at the same time. CallbackPanel works as if it did not exist. So try to code without the CallbackPanel first. Once you get that working, you can add the CallbackPanel in, set the trigger and everything should just work for you.

Thanks
Bottom Line Gurus
Posted: Friday, October 8, 2010 7:17:57 PM
Rank: Newbie
Groups: Member

Joined: 10/8/2010
Posts: 3
I put the textbox4 code as a chance. (As you can see in the code) textbox1,textbox2 & textbox3 also are triggers on the same callback, tested without result. The radiobuttons work, but not the textboxes.

PS: I can assume a textbox already triggers the callbackpanel? I guess I need something else, a way to specify which event will be the trigger (keypress, lostfocus, click, etc). Can you correct my code and make it work, so the textboxes triggers the panel?

TIA;
eo_support
Posted: Friday, October 8, 2010 7:31:16 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You will need to set the textbox's AutoPostBack to true in order for the textbox to trigger it's TextChanged event. That is a TextBox property and has nothing to do with us at all. That is why we did not answer your question directly in your first post and asked you to get your code to work without the CallbackPanel first. To avoid abuse, we generally do not troubleshoot user code errors that are unrelated to our product at all. In the future, if you see a problem that can happen without our product, then you should try to resolve it yourself.

Thanks
Bottom Line Gurus
Posted: Friday, October 8, 2010 8:13:14 PM
Rank: Newbie
Groups: Member

Joined: 10/8/2010
Posts: 3
In the future, if you see a problem that can happen without our product, then you should try to resolve it yourself

1. autopostback set in true in a textbox doesnt make a callback in a textchange event.
2. autopostback set in true in a textbox refresh the whole screen on a lostfocus (with or without the callbackpánel).
2. callbackpanel doenst work with autopostback set in false.


eo_support
Posted: Friday, October 8, 2010 8:27:14 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The two rules are:

A. AutoPostBack controls whether the TextBox triggers a post back (thus triggers TextChanged event). This part has nothing to do with our CallbackPanel;
B. The CallbackPanel's Triggers collection control whether to turn a post back into an AJAX callback. This part has nothing to do with the TextBox;

You will have to have both condition A and B meet in order to have a callback because condition B would be meaningless if there is no postback to convert to callback at all. In another word, a callback (with CallbackPanel) is always a post back (without CallbackPanel) first. That’s why we asked you to get it working without the CallbackPanel first.

So come back to your statements:
1. "autopostback set in true in a textbox doesnt make a callback in a textchange event". This is false. If you have both A and B set up correctly, you should see the callback. If you still can not get it to work, try to create a test page to demonstrate the problem and we will be happy to take a look;

2. "autopostback set in true in a textbox refresh the whole screen on a lostfocus (with or without the callbackpánel).". This is the same as case #1;

3. "callbackpanel doenst work with autopostback set in false.". Of course it won't because condition A is not met;

In any case, you should completely forget about CallbackPanel_Execute event. You do not need to handle that event.

Hope this helps.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.