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

Wednesday, March 28, 2012

Multiple Update Panels - Postback on Panel A cancels Postback on Panel B

Hi,

I have a page with multiple Update Panels. Each panel has a button as a trigger.

When the first button is clicked it causes the first panel to update (as you'd expect), however if while this panel is being updated, the second button is clicked to update the second panel, the first request is cancelled, and the first panel is never updated.

Is this the expected behavior? Are there any work arounds?

Many Thanks,
Ady

Yes, unfortunately it is by design. Only the last UpdatePanel requets will be considered and prior reuests discarded.

Hmm, thats a shame.

I wonder if there is a way to intercept the request, and effectively queue it until the first request completes.

Time to start playing.


This tutorial might help you get started:http://ajax.asp.net/docs/tutorials/ExclusiveAsyncPostback.aspx.

Multiple UpdatePanels require their controls to enable ViewState?

I've got 2 update panels on the same page. up1 contains a link button and up2 contains a repeater. I don't need or want the repeater in up2 to be added to Viewstate. However, when up1's link button is clicked, the async call works fine but on return it clears out up2's content. If I set the repeater in up2 to enable viewstate, it then works. If upatepanels are supposed to implement partial page updates, why does up1 wipe out up2's content if up2's content is not in viewstate?

A wild stab in the dark : Is up2.UpdateMode set to "Condtional" ?? if not, then it has a default mode "Always", and gets refreshed on each async postback. If you do not redraw the repeater at that time, or get it from viewstate, then well - you get zilch :)


Ah, yes, that's it. I would have thought the default updatemode would be "Conditional" rather than "Always". Having all the updatepanels update seems counterintuitive to the idea of a partial page update. Anyway, thanks.

Multiple updatepanels and updateprogress

Hi,

I have created two updatepanels with a button and a label in each panel. Both panels are associated to a updateprogress. When I click the button I simle add datetime.now to the label. I also use thread.sleep for some seconds. This is a basic asp.net ajax example. But my question is: when I click the first button and thereafter click the second button when the first one is at sleep. In this case the second updateprogress starts working and I get the date in the second label. How can I manage to implement two asynchronous calls at the same time? i.e. I want to press both buttons and get two dates in each label.

You can't execute two partial postbacks simultaneously.

In InitializeRequest, you can use PageRequestManager.get_isInAsyncPostBack() to test for an already running partial postback and respond accordingly.


Ok, thank you. My question is answered!

Monday, March 26, 2012

Multiview control

Hi.

I used three radio button to switch among multiview control, how may I include AJAX into radio button control, so it doesn't post back when I try to change view ? I tried, it doesn't seem to work.

thanks for the help.

Hi,

You can avoid the postback by wrapping them in an UpdatePanel. For instance:

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) { MultiView1.ActiveViewIndex = RadioButtonList1.SelectedIndex; }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div>  <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> </asp:RadioButtonList> <asp:MultiView ID="MultiView1" runat="server"> <asp:View ID="View1" runat="server"> View1</asp:View> <asp:View ID="View2" runat="server"> View2</asp:View> <asp:View ID="View3" runat="server"> View3</asp:View> </asp:MultiView> </ContentTemplate> </asp:UpdatePanel> </form></body></html>
Hope this helps.

thanks.

But, I don't understand, in the radio button, it says AutoPostBack=true. I did exactl the way you did except put radio button in the updatepanel, what is the magic for this updatepanel ?

thanks so much for the help.


That's weird. Can you show me your page?


Hi. this is my code.

<divstyle="border-bottom:dotted; border: 1px;">

<asp:MultiViewid="MultiView1"runat="server"ActiveViewIndex="0">

<asp:ViewID="View1"runat="server">

<asp:LabelID="lblMsg"runat="server"Width="273px"Font-Bold="True"ForeColor="Red"></asp:Label><br/>

<asp:TextBoxID="txtAddress"runat="server"></asp:TextBox>

<asp:LabelID="Label2"runat="server"Text="Ex. 101 Monroe St"Width="111px"></asp:Label><br/>

<asp:TextBoxID="txtZip"runat="server"></asp:TextBox>

<asp:LabelID="Label3"runat="server"Text="Ex. 20850"Width="106px"></asp:Label><br/>

<asp:TextBoxID="txtMiles"runat="server">2</asp:TextBox>

<asp:LabelID="Label4"runat="server"Text="Within Miles"Width="107px"></asp:Label><br/>

<asp:ButtonID="btnAddress"runat="server"Text="Find"OnClick="btnAddress_Click"/>

</asp:View>

<asp:ViewID="View2"runat="server">

<asp:DropDownListID="lstCities"runat="server"></asp:DropDownList><br/>

<asp:ButtonID="btnCities"runat="server"Text="Find"OnClick="btnCities_Click"/>

</asp:View>

<asp:ViewID="View3"runat="server">

<asp:DropDownListID="lstZipCode"runat="server">

</asp:DropDownList>

<asp:ButtonID="btnZip"runat="server"Text="Find"OnClick="btnZip_Click"/>

</asp:View>

</asp:MultiView>

</div>


The code you posted isn't sufficient to reproduce the issue. Can you show me more?


<divstyle="border-bottom:dotted; border: 1px;">

<asp:RadioButtonID="RadioButton1"runat="server"Text="Address"GroupName="grpSelection"AutoPostBack="true"OnCheckedChanged="RadioButton1_CheckedChanged"Font-Bold="True"ForeColor="Blue"Width="80px"checked="true"/>

<asp:RadioButtonID="RadioButton2"runat="server"Text="Cities"GroupName="grpSelection"OnCheckedChanged="RadioButton2_CheckedChanged"AutoPostBack="True"Font-Bold="True"ForeColor="Blue"Width="67px"/>

<asp:RadioButtonID="RadioButton3"runat="server"Text="Zip Code"GroupName="grpSelection"OnCheckedChanged="RadioButton3_CheckedChanged"AutoPostBack="True"Font-Bold="True"ForeColor="Blue"Width="84px"/>

</div>

<scriptlanguage="c#"runat="server">

protectedvoid RadioButton1_CheckedChanged(object sender,EventArgs e)

{

MultiView1.SetActiveView(View1);

}

protectedvoid RadioButton2_CheckedChanged(object sender,EventArgs e)

{

MultiView1.SetActiveView(View2);

}

protectedvoid RadioButton3_CheckedChanged(object sender,EventArgs e)

{

MultiView1.SetActiveView(View3);

}

</script>

thanks.


Here is the page that I made with the codes your provided, it worked fine.

<%@. Page Language="C#" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void RadioButton1_CheckedChanged(object sender, EventArgs e) { MultiView1.SetActiveView(View1); } protected void RadioButton2_CheckedChanged(object sender, EventArgs e) { MultiView1.SetActiveView(View2); } protected void RadioButton3_CheckedChanged(object sender, EventArgs e) { MultiView1.SetActiveView(View3); } protected void btnAddress_Click(object sender, EventArgs e) { } protected void btnCities_Click(object sender, EventArgs e) { } protected void btnZip_Click(object sender, EventArgs e) { }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <asp:UpdatePanel runat="server" ID="up1"> <ContentTemplate> <div style="border-bottom:dotted; border: 1px;"><asp:MultiView id="MultiView1" runat="server" ActiveViewIndex="0"><asp:View ID="View1" runat="server"><asp:Label ID="lblMsg" runat="server" Width="273px" Font-Bold="True" ForeColor="Red"></asp:Label><br /><asp:TextBox ID="txtAddress" runat="server"></asp:TextBox><asp:Label ID="Label2" runat="server" Text="Ex. 101 Monroe St" Width="111px"></asp:Label><br /><asp:TextBox ID="txtZip" runat="server"></asp:TextBox><asp:Label ID="Label3" runat="server" Text="Ex. 20850" Width="106px"></asp:Label><br /><asp:TextBox ID="txtMiles" runat="server">2</asp:TextBox><asp:Label ID="Label4" runat="server" Text="Within Miles" Width="107px"></asp:Label><br /><asp:Button ID="btnAddress" runat="server" Text="Find" OnClick="btnAddress_Click" /></asp:View><asp:View ID="View2" runat="server"><asp:DropDownList ID="lstCities" runat="server"></asp:DropDownList><br /><asp:Button ID="btnCities" runat="server" Text="Find" OnClick="btnCities_Click" /></asp:View><asp:View ID="View3" runat="server"> <asp:DropDownList ID="lstZipCode" runat="server"></asp:DropDownList>     <asp:Button ID="btnZip" runat="server" Text="Find" OnClick="btnZip_Click" /></asp:View></asp:MultiView></div><div style="border-bottom:dotted; border: 1px;"> <asp:RadioButton ID="RadioButton1" runat="server" Text="Address" GroupName="grpSelection" AutoPostBack="true" OnCheckedChanged="RadioButton1_CheckedChanged" Font-Bold="True" ForeColor="Blue" Width="80px" checked="true" />    <asp:RadioButton ID="RadioButton2" runat="server" Text="Cities" GroupName="grpSelection" OnCheckedChanged="RadioButton2_CheckedChanged" AutoPostBack="True" Font-Bold="True" ForeColor="Blue" Width="67px" />      <asp:RadioButton ID="RadioButton3" runat="server" Text="Zip Code" GroupName="grpSelection" OnCheckedChanged="RadioButton3_CheckedChanged" AutoPostBack="True" Font-Bold="True" ForeColor="Blue" Width="84px" /></div> </ContentTemplate> </asp:UpdatePanel> </form></body></html>

Another tip is you need to make sure ajax extension is successfully installed on your machine, andnecessary entries have been added into your web.config.


thanks. let me try it out !


Hi.

just tried it. I don't have the file for AjaxControlToolkit, where may I find the file ?

thanks.


Hi.

In order to use UpdatePanel, I have to install AjaxControltoolkit, right ?

thanks.


shukuo:

Hi.

just tried it. I don't have the file for AjaxControlToolkit, where may I find the file ?

thanks.

http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=4923


shukuo:

Hi.

In order to use UpdatePanel, I have to install AjaxControltoolkit, right ?

thanks.

No, Ajax Extension is enough.

MultiView containing an UpdatePanel: cant switch ActiveViewIndex?

I have a button control inside of an UpdatePanel. This UpdatePanel sits inside of a MultiView control (which is NOT inside another UpdatePanel, just a regular multiview). The function that is fired from the button click is supposed to change the ActiveViewIndex, but it does not. It fires off other actions inside the function, but does not change the multiview.


Is there something I need to do to get this to work? Here is roughly what I'm talking about. In this case it's set to ActiveViewIndex = 0. I need the button to change it to index 1. Thanks!!

<asp:MultiView runat="server" ID="someID">

<asp:View runat="server"

<asp:UpdatePanel runat="server">

<contenttemplate>

<asp:Button runat="server" onclick="MyFunction" Text="CLICK ME" />

</contenttemplate>

<asp:UpdatePanel>

</asp:View>

<asp:View runat="server">

SOME LITERAL HTML CONTENT

</asp:View>
</asp:MultiView


hi rpeters,

what are you using for your MyFunction?

should be something like this, right?

multiviewAppSec.SetActiveView((

View)this.multiviewAppSec.FindControl("ViewName")));

I was simply using...

myMultiView.ActiveViewIndex = 1;



pixelsyndicate:

hi rpeters,

what are you using for your MyFunction?

should be something like this, right?

multiviewAppSec.SetActiveView((View)this.multiviewAppSec.FindControl("ViewName")));

Tried using the approach as well. No difference... :(

Anyone??


I am pretty sure I tried that before, and didn't get it to work. the definition of that property says its Sets or Gets... so it should work. Try using the

SetActiveView(view) method to make that change. You will have to pass it a reference to the View you want however. Using the findcontrol() method example I used should help you to do that. Respond back on whether it worked or not. ;)


pixelsyndicate:

I am pretty sure I tried that before, and didn't get it to work. the definition of that property says its Sets or Gets... so it should work. Try using the

SetActiveView(view) method to make that change. You will have to pass it a reference to the View you want however. Using the findcontrol() method example I used should help you to do that. Respond back on whether it worked or not. ;)

Tried it...no luck. Same result as by setting the property.


Anyone else? There has to be a way!

you stated you were using 1 as the view index to display. isn't the view you want to show actually the first view? that would mean you need to display view index ZERO (0). indexes are zero-based, meaning its it this order...

0
1
2
3
4
5
6
...


pixelsyndicate:

you stated you were using 1 as the view index to display. isn't the view you want to show actually the first view? that would mean you need to display view index ZERO (0). indexes are zero-based, meaning its it this order...

0
1
2
3
4
5
6
...

I know that they are zero-based indices. I also am using the correct view index for my application. The problem is that it seems that because it is being called from a routine that is inside of an update panel, it is trying to make the change inside that panel, rather than changing the entire page to reflect the new panel.

anyone else?? thanks.

multiview requiredfieldvalidator and updatepanel error - entire simple code posted

Problem is when I click on linkbutton2 then click on the button on that page is get the null error. It's being caused because it's looking for the validator from view1.

I know I can say causesvalidation=false, but I will have tons of items in view2 and don't want to do it that way.

I want to say RequiredFieldValidator1.enabled=false for the view2 section. But where do I call this? Also when they go back to view1 it should say this RequiredFieldValidator1.enabled=true.

code behind:

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
MultiView1.ActiveViewIndex = 0
End Sub

Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
MultiView1.ActiveViewIndex = 1
End Sub

source:

<form id="form1" runat="server">
<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<atlas:UpdatePanel runat="server" ID="calendarupdatepanel">

<ContentTemplate>

<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" CausesValidation="false">Search</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" OnClick="LinkButton2_Click" CausesValidation="false">Results</asp:LinkButton>
<br />
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="view1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</asp:View>
<asp:View ID="view2" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" />
</asp:View>
</asp:MultiView>
<asp:Label id="ActiveViewLabel"
BorderStyle=None
Font-Size=Small
BackColor="#ffff66"
runat="Server" Text="" >
</asp:Label>
</ContentTemplate>
</atlas:UpdatePanel>

</form

fixed this one - never mind

My Custom Control Extender no longer works

I have a control extender that disabled a button when clicked to prevent multiple clicks. It worked well on my test.aspx page but when I moved it over to my big project, I get this error:

"Sys.ArgumentException: Value must not be null for Controls and Behaviors.Parameter name: element"

The page I moved it on contains a MasterPage with a home.aspx, and within that there is a .ascx and in there is where my button + control extender are found. Here is the code.

.cs:

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI;

[assembly: System.Web.UI.WebResource("OneClickExtender.OneClick.js","text/javascript")]

namespace OneClickExtender
{
[TargetControlType(typeof(Button))]
[TargetControlType(typeof(ImageButton))]
public class OneClick : ExtenderControl
{
private string _submitScript = null;
protected override IEnumerable<ScriptDescriptor> GetScriptDescriptors(Control targetControl)
{
ScriptBehaviorDescriptor behavior = new ScriptBehaviorDescriptor("OneClickExtender.OneClickBehavior",targetControl.ID);
behavior.AddProperty("submitScript", _submitScript);

yield return behavior;

}

protected override IEnumerable<ScriptReference> GetScriptReferences()
{
ScriptReference sr = new ScriptReference();
sr.Name = "OneClickExtender.OneClick.js";
sr.Assembly = "OneClickExtender";

yield return sr;
}

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Control target = new Control();
target = FindControl(this.TargetControlID);
if (target != null)
_submitScript = Page.ClientScript.GetPostBackEventReference(target, string.Empty);
}
}
}

.js:


Type.registerNamespace('OneClickExtender');

OneClickExtender.OneClickBehavior = function(element) {
OneClickExtender.OneClickBehavior.initializeBase(this, [element]);
var _clickDelegate = null;
var _onSubmitScript = null;


}

OneClickExtender.OneClickBehavior.prototype = {
initialize : function() {
OneClickExtender.OneClickBehavior.callBaseMethod(this, 'initialize');
var e = this.get_element();
this._clickDelegate = Function.createDelegate(this,this._onClickDelegate);
$addHandler(e,"click",this._clickDelegate);
},

_onClickDelegate : function() {
this.get_element().disabled = true;
eval(this._onSubmitScript);
},

get_submitScript : function() {
return this._onSubmitScript;
},

set_submitScript : function(value) {
this._onSubmitScript = value;
},

dispose: function() {
$clearHandlers(this.get_element ());
OneClickExtender.OneClickBehavior.callBaseMethod(this, "dispose");
}
}

OneClickExtender.OneClickBehavior.registerClass("OneClickExtender.OneClickBehavior", Sys.UI.Behavior);

--

Any ideas?

hello.

instead of using targetcontrol.id i think that you should use targetcontrol.clientid.


This fixed it. However, because I am using asp:RequiredFieldValidator, my button gets disabled and never re-enables itself. I would have to make sure all fields were valid first. I will look into this right now.

Saturday, March 24, 2012

Need desperate help with an ajax functionality. Deadline in two days.

Hello. I have a question regarding animationextender and tables...

if you go to...

http://doc000.emailster.com/test.aspx

And click on the button in the middle left, you will see the above image move to the left, while the table cell on the right containing the word "right" does not expand along with the moving div layer. it stays stationary. This is visible in IE, however, in FF it works ok..

I put my code below...

This is the html portion that I am testing:

<tableborder="1">

<tr>

<tdstyle="width:197px;">

<asp:PanelID="pSideMenu"Style="position:relative;"runat="server">

<imgalt="TRSh"src="/images/Create-New-Material.gif"width="197"height="47"/>

</asp:Panel></td>

<tdstyle="width:100%;">right</td>

</tr>

</table>

This is my ajax code:

<ajaxToolkit:AnimationExtenderID="AnimationExtender1"runat="server"TargetControlID="collapserClose">

<Animations>

<OnClick>

<Sequence>

<parallelDuration=".20"Fps="25">

<MoveAnimationTarget="pSideMenu"Horizontal="-180"/>

<ResizeAnimationTarget="pSideMenu"width="10px"/>

</parallel>

<StyleActionAnimationTarget="collapserClose"Attribute="display"Value="none"/>

<StyleActionAnimationTarget="collapserOpen"Attribute="display"Value="block"/>

</Sequence>

</OnClick>

</Animations>

</ajaxToolkit:AnimationExtender>

<ajaxToolkit:AnimationExtenderID="AnimationExtender2"runat="server"TargetControlID="collapserOpen">

<Animations>

<OnClick>

<Sequence>

<parallelDuration=".20"Fps="25">

<MoveAnimationTarget="pSideMenu"Horizontal="180"/>

<ResizeAnimationTarget="pSideMenu"width="197px"/>

</parallel>

<StyleActionAnimationTarget="collapserClose"Attribute="display"Value="block"/>

<StyleActionAnimationTarget="collapserOpen"Attribute="display"Value="none"/>

</Sequence>

</OnClick>

</Animations>

</ajaxToolkit:AnimationExtender>

Any help would be very much appreciated. In fact, i would be so grateful, I'm willing to put money in on this. Negotiable (message me).

I've spent around 2 days on this now. And it's eating up the work hours. So I'm fairly desperate. Thanks so much.

Sincerely,

Jeff

I tested your page with firefox and ie7, didn't see anything moving...

Maybe you need something like this:

<StyleActionAnimationTarget="[...]"Attribute="overflow"Value="hidden"/>

Except you want overflow visible? (Not sure I understood your problem though..)


Well, if you click the button. You should see something happen at the very top left corner. See it?


Why don't you use a collapsiblepanelextender instead...this has built-in animation for the collapse/expand and may resolve your problem.


Well, I did that at the beginning. But the animationextender gives much more flexibility in terms of FPS, and duration, and also, it allows me to specify how much it should be moved. I tried using the "expandedsize" and "collapsedsize" for the collapsiblepanel, but it did not work.

I'm stuck.

Help.

Thanks.

Wednesday, March 21, 2012

need help for UpdatePanel

Hi

I created one page with AJAX.Net. My page is as follow. It is working fine. but When I click on Save button It save the data into the database and reset the Controls value[using ResetControls() methods]. this method is fired but it is not reset the controls value. I do not know why? Can Any body help me? I put my .aspx and Save button event.

<

asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true"></asp:ScriptManager>

<

asp:UpdatePanelID="UpdatePanel1"runat="server">
<ContentTemplate>

<tablecellspacing="0"cellpadding="2"width="97%"border="0"align="center">
<tr><tdalign="right"style="height: 28px"width="18%"></td><tdstyle="height: 28px"width="2%"></td><tdclass="ItemDetail"style="height: 28px"width="80%">
<asp:LabelID="lblMessage"runat="server"SkinID="errorLable"></asp:Label></td></tr></table>

</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTriggerControlID="btnSave"EventName="Click"/>
</Triggers>

</asp:UpdatePanel>

<tablecellspacing="0"cellpadding="2"width="97%"border="0"align="center">
<tr><tdwidth="18%"style="height: 28px"align="right"><asp:LabelID="lblDate"runat="server"Text="Date"SkinID="requiredLabel"></asp:Label></td>
<tdwidth="2%"style="height: 28px"> </td><tdwidth="80%"class="ItemDetail"style="height: 28px">
<asp:TextBoxID="txtDate"runat="server"Columns="15"MaxLength="12"></asp:TextBox>
<asp:Imagerunat="Server"ID="Image1"ImageUrl="~/images/cal.gif"ToolTip="Click to show calendar"style="border-width:0px;"DescriptionUrl="#"/>
<cc1:CalendarExtenderID="CalendarExtender1"runat="server"Format="MMMM d, yyyy"TargetControlID="txtDate"BehaviorID="CalendarExtender1"PopupButtonID="image1">
</cc1:CalendarExtender>
</td></tr><tr><tdalign="right"><asp:LabelID="lblSpeaker"runat="server"Text="Speaker"SkinID="requiredLabel"></asp:Label></td><td> </td><tdclass="ItemDetail">
<asp:TextBoxID="txtSpeakerName"runat="server"Columns="30"MaxLength="50"></asp:TextBox></td></tr>

<tr><tdalign="right"><asp:LabelID="lblTopic"runat="server"Text="Topic"></asp:Label> </td><td> </td><tdclass="ItemDetail">
<asp:TextBoxID="txtTopic"runat="server"Columns="45"MaxLength="100"></asp:TextBox></td></tr
<tr><tdvalign="top"align="right"><asp:LabelID="lblComments"runat="server"Text="Comments"></asp:Label> </td><td> </td><tdclass="ItemDetail">
<tablecellpadding="2"cellspacing="0"border="0"><tr><td>
<FTB:FreeTextBoxID="txtComments"runat="server"AllowHtmlMode="True"BreakMode="LineBreak"
ButtonSet="OfficeXP"ConvertHtmlSymbolsToHtmlCodes="True"DisableIEBackButton="True"Height="175px"SupportFolder="/CRRoot/FreeTextBox/"ToolbarLayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImage,InsertRule|Cut,Copy,Paste;Undo,Redo,Print,InsertImageFromGallery"></FTB:FreeTextBox> </td></tr></table></td></tr
<tr><tdclass="ItemHeading"valign="top"align="right"></td><td></td><tdclass="ItemDetail"></td></tr
<tr><tdcolspan="3"class="CommandBar"> <asp:ButtonID="btnSave"runat="server"Text=" Save "OnClick="btnSave_Click"AccessKey="S"/>
<asp:ButtonID="btnCancel"runat="server"Text=" Cancel "CausesValidation="False"OnClick="btnCancel_Click1"AccessKey="C"/></td></tr
</table
===============================

protectedvoid btnSave_Click(object sender,EventArgs e){

string Errors = validation();
if (Errors.Length > 0)
{
lblMessage.Text = Errors;
lblMessage.Visible =true;
return;}DateTime SpeakerDate =DateTime.Today;
DateTime.TryParse(txtDate.Text.Trim(),out SpeakerDate);
string SpeakerName = txtSpeakerName.Text.Trim();
string Topic = txtTopic.Text.Trim();
string Comments = txtComments.Text.Trim();
string Action = ((Utilities.ProcessStatus)this.ProcessMode).ToString();
int Success =Speaker.SpeakerAddEditDelete(CookiesInfo.ClubId,this.SpeakerId, SpeakerDate,
SpeakerName, Topic, Comments, Action);
if (Success == -1)
{
lblMessage.Text =" - Record has not been saved. Please check the inputs.";
lblMessage.Visible =true;
}else{
ResetControls();
lblMessage.Text =" - Record has been saved successfully.";
lblMessage.Visible =true;
}
}privatevoid ResetControls(){

txtDate.Text =String.Format("{0:MMMM d, yyyy}",DateTime.Today);
txtSpeakerName.Text =string.Empty;
txtComments.Text =string.Empty;
txtTopic.Text =string.Empty;

}

The textboxes are not part of the UpdatePanel's ContentTemplate.

hence , inaccessible from the server.

Move them inside the UpdatePanel and they will be accessible .

Hope this helps

Need Help in Ajax Dialog box loosing control

I have ajax dialog box for search data. When it opens dialog box it has a text box in which I can search and it populates the radio button list based on the search. When i select 1 record and hit submit it works on my dev box but on my production box when i click search it does not populate the radio button list. Does any one had similar kind of issue? and if yes can someone please tell me what to do to fix this..

Thanks

Hi,

Based on your description, I think is incurred by incorrect configuration on your production box since your application works fine on dev box.

Please make sure the ajax extension is installed on the production box, and the site is configured to asp.net 2.0.

Need help in UpdateProgress Control inside ModalPopup Control

Hi All,

I need to show the progress control inside ModalPopup Control. Everytime I hit the button, the modalpopup should show the progress while the background code of the button is working. Modalpopup dialog show disappear when the background executing is done. For modalpopup control I set the targetcontrolID as the ID of the button.

When I click the button, the modalpopup dialog show up. But it doesn't trigger the background code of the button. Do I miss anything?
Thank you.

Fred

Hi,

What you need is keeping the modalpopup showing when the background executing is done.

So see:

http://forums.asp.net/t/1134216.aspx

http://forums.asp.net/t/1134520.aspx

These are what you need.

Best Regards,

Need Help with Ajax Examples

Hi..

can anybody provide a working example of using the dropdownlist and grid view control and saving the data with a button using AJAX..

please help..

The page requirements:
1) Table/Grid displays a list of states (U.S. states) with a column for the state name and a column that contains a dropdown list of the state's cities.
2) Upon selecting a city, the page will display the city name (and perhaps futher lookup some information specific to the city).

The basic ASP.NET flow here is (using 2.0 here, but works similarly in 1.1 using DataGrid):
1) Create a GridView with a bound column for state and a template column for the DropDownList
2) Create a label to display the city name upon selecting it in the DropDownList.
3) Bind the GridView to an array of state objects (could be bound to many other things as well, but keeping it simple for this example). State contains properties for Name and for Cities.
4) Hookup RowCreated event on the GridView so that we can populate the cities into the particular row's DropDownList.
5) Add postback event for getting the selected city and populating the label with it.

Here's what the aspx code looks like:

<asp:GridView ID="gvStates" AutoGenerateColumns="false"
runat="server" OnRowCreated="gvStates_RowCreated">
<Columns>
<asp:BoundField HeaderText="State" DataField="Name" />
<asp:TemplateField HeaderText="Cities">
<ItemTemplate>
<asp:DropDownList ID="ddlCities"
AutoPostBack="true" runat="server"
OnSelectedIndexChanged="ddlCities_SelectedIndexChanged">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView
<asp:Label ID="lblCity" runat="server" Text="Label">
</asp:Label
And here's the code behind:

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Create states array and bind it to Grid
ArrayList states = new ArrayList();

string[] cities =
new string[] { "Portland", "Salem", "Eugene" };
State state = new State("OR", cities);
states.Add(state);
cities =
new string[] { "Seattle", "Tacoma", "Olympia" };
state = new State("WA", cities);
states.Add(state);

this.gvStates.DataSource = states;
this.gvStates.DataBind();
}
}

protected void gvStates_RowCreated(object sender,
GridViewRowEventArgs e)
{
if (!IsPostBack)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Bind drop down to cities
DropDownList ddl =
(DropDownList)e.Row.FindControl("ddlCities");
ddl.DataSource = ((State)e.Row.DataItem).Cities;
ddl.DataBind();
}
}
}

protected void ddlCities_SelectedIndexChanged(object sender,
EventArgs e)
{
this.lblCity.Text = ((DropDownList)sender).SelectedValue;
}

In Ajax framework,you can place them in a asp:UpdatePanel and specify asynchronous postback in the triggers of the asp:UpdatePanel.

Wish this can help you.