Showing posts with label click. Show all posts
Showing posts with label click. Show all posts

Wednesday, March 28, 2012

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!

Multiple UpdatePanels, Multiple Page_Loads

I have two UpdatePanels which fire when a Click event executes on my page. I get two Page_Load events firing because the two update panels are triggered.

Is there a way to run the Page_Load only once but have both panels update?

Thanks :)

Hello,

Do you want to update both the update panels?

You can set UpdateMode="Conditional" for the update panel and can add a AsyncPostBackTrigger for the update panel

<asp:AsyncPostBackTrigger ControlID="btn" EventName="Click" />

Thanks,

Deepesh Verma


I have my update panels set up like you mentioned however I still get the double page_load.

Update panel 1 and Update panel 2 have the following trigger defined:

<asp:asyncpostbacktrigger controlid="btnSearch" eventname="Click" />

If I remove the trigger from the second Update panel then I will get only one page_load, however since I need to update the second update panel I tried to do it through code like this:

up2.Update();

However this also causes the Page_Load to fire again. Any other ideas?


Hello,

This seems that you have two different update panel and for both you have sameasyncpostbacktrigger.

If this is the case then you can have only one update panel to do that.

Thanks,

Deepesh Verma


SuperGhost:

However this also causes the Page_Load to fire again. Any other ideas?

Are you sure that Page_Load is fired twice?

I've made a simple example and Page_Load is fired only once, it shouldn't depend on how many up are updating...

(

Also works when you set the same trigger

<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn" EventName="click" />
</Triggers>

for each up, and won't call this.up2.update( ) in the server side click event

)

aspx:

<%@. Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AJAXCTPEnabledWebApplication1._Default" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="up1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="btn" runat="server" Text="test" />
<%= "Load count" + this.LoadCount.ToString( )%>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="up2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%= "Load count" + this.LoadCount.ToString( )%>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>

Code-behind:
 
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace AJAXCTPEnabledWebApplication1
{
public partialclass _Default : System.Web.UI.Page
{
private int m_LoadCount = 0;

/// <summary>
/// Gets or sets LoadCount (this property is stored/retrived using the viewstate).
/// </summary>
public int LoadCount
{
get
{
return (int )(this.ViewState["m_LoadCount" ] ?? m_LoadCount );
}
set
{
this.ViewState["m_LoadCount" ] = m_LoadCount =value;
}
}

protected override void OnInit( EventArgs e )
{
base.OnInit( e );

this.btn.Click +=new EventHandler( btn_Click );
}

private void btn_Click(object sender, EventArgs e )
{
this.up2.Update( );
}

protected void Page_Load(object sender, EventArgs e )
{
this.LoadCount++;
}
}
}

 

Monday, March 26, 2012

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

Must Click Twice for Event to Fire

I have an GridView with an Select link on each line. The link brings up a modal popup for editing data. The GridView is inside an updatepanel.

Everything works great, except for some reason, I have to click the Select link twice for the event to fire. The first click does nothing...does not enter the

SelectedIndexChanged event at all.

Anyone know why?

Wanna post your HTML here so we can take a peek?

WS


Sure here you go..

<%

@.ControlLanguage="vb"AutoEventWireup="false"Codebehind="Packer.ascx.vb"Inherits="WDE.Packer" %>

<%

@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>

<

divid="PackerUpdatePanel"><asp:UpdatePanelID="UpdatePanelPackers"runat="server"UpdateMode="Conditional"><ContentTemplate><asp:PanelID="PanelPackersHeader"runat="server"CssClass="collapsePanelHeader"Height="30px"><divstyle="padding: 5px; vertical-align: middle;"><divstyle="float: left;"><asp:LabelID="LblPackers"runat="server"Text="Packers"></asp:Label></div><divstyle="float: left; margin-left: 5px;"><asp:LabelID="LblPackersCount"runat="server"></asp:Label></div><divstyle="float: right; vertical-align: middle; cursor: hand"><asp:ImageButtonID="ImageExpand"runat="server"ImageUrl="~/images/expand_blue.jpg"/></div><divstyle="float: right; margin-right: 20px;"></div></div></asp:Panel><asp:PanelID="PanelPackersViewDetails"runat="server"Height="100%"Width="100%"Wrap="False"><tableid="border"width="100%"cellpadding="0"cellspacing="0"><tr><tdclass="addHeader"><divstyle="float: right; margin-right: 1px;cursor: hand"><asp:LinkButtonID="HyperLinkAddPacker"runat="server"OnClick="HyperLinkAddPacker_Click"ForeColor="White"CssClass="hyperlinkNoLine">Add New Packer</asp:LinkButton></div></td></tr><tr><td><asp:GridViewID="packerGrid"runat="server"CellPadding="4"DataSourceID="PackersXmlDataSource"Width="100%"ForeColor="#333333"AutoGenerateColumns="False"GridLines="None"OnSelectedIndexChanged="packerGrid_SelectedIndexChanged"><FooterStyleBackColor="#5D7B9D"Font-Bold="True"ForeColor="White"/><RowStyleBackColor="#F7F6F3"ForeColor="#333333"/><EditRowStyleBackColor="#999999"/><SelectedRowStyleBackColor="#E2DED6"Font-Bold="True"ForeColor="#333333"/><PagerStyleBackColor="#284775"ForeColor="White"HorizontalAlign="Center"/><HeaderStyleBackColor="#5D7B9D"Font-Bold="True"ForeColor="White"/><AlternatingRowStyleBackColor="White"ForeColor="#284775"/><Columns><asp:CommandFieldShowSelectButton="True"SelectText="Edit"/><asp:BoundFieldDataField="packerDate"HeaderText="Date"SortExpression="packerDate"><ItemStyleHorizontalAlign="Left"/><HeaderStyleHorizontalAlign="Left"/></asp:BoundField><asp:BoundFieldDataField="packerOperation"HeaderText="Operation"SortExpression="packerOperation"><HeaderStyleHorizontalAlign="Left"/><ItemStyleHorizontalAlign="Left"/></asp:BoundField><asp:BoundFieldDataField="packerCode"HeaderText="Code"SortExpression="packerCode"><HeaderStyleHorizontalAlign="Left"/><ItemStyleHorizontalAlign="Left"/></asp:BoundField><asp:BoundFieldDataField="packerDepth"HeaderText="Depth"SortExpression="packerDepth"><HeaderStyleHorizontalAlign="Left"/><ItemStyleHorizontalAlign="Left"/></asp:BoundField><asp:CommandFieldButtonType="Image"DeleteImageUrl="~/Images/DELETE.jpg"ShowDeleteButton="True"/></Columns></asp:GridView></td></tr></table></asp:Panel><ajaxToolkit:CollapsiblePanelExtenderID="CollapsiblePanelExtenderPackers"runat="Server"TargetControlID="PanelPackersViewDetails"ExpandControlID="ImageExpand"CollapseControlID="ImageExpand"Collapsed="True"ExpandedImage="~/images/collapse_blue.jpg"CollapsedImage="~/images/expand_blue.jpg"ImageControlID="ImageExpand"SuppressPostBack="true"/></ContentTemplate></asp:UpdatePanel>

</

div>

<

divid="PackersMaintenancePanelDiv"><asp:ButtonID="FakePackerTarget"runat="server"Style="display: none"></asp:Button><ajaxToolkit:ModalPopupExtenderID="ModalPopupAddEditPacker"runat="server"TargetControlID="FakePackerTarget"PopupControlID="PanelPackerAddEdit"BackgroundCssClass="modalBackground"DropShadow="false"CancelControlID="btnCancel"/><asp:PanelID="PanelPackerAddEdit"runat="server"Width="45%"Wrap="False"Style="display: none"BorderStyle="Solid"BorderColor="#6b8aad"><asp:UpdatePanelID="UpdatePanelPackerModalPopup"runat="server"><ContentTemplate><tableid="AddPackTable"runat="server"style="width: 100%; background-color: white;"><tr><tdcolspan="3"style="font-size: 10pt; background-color: #6b8aad; color: White"><asp:LabelID="lblPackerHeader"runat="server"Text="Packer"></asp:Label></td></tr><tr><td><asp:LabelID="lblPackerDate"runat="server"Text="Date:"Width="78px"></asp:Label><br/></td><td><asp:TextBoxID="txtPackerDate"runat="server"></asp:TextBox><spanstyle="font-size: 10pt; color: #ff0033">* </span><asp:ImageButtonID="ImageBtnCalendar"runat="server"ImageUrl="~/Images/CalendarButton.gif"/><ajaxToolkit:PopupControlExtenderID="PopupControlExtenderPackerDate"runat="server"TargetControlID="ImageBtnCalendar"PopupControlID="PanelCalendar"Position="Bottom"/><spanstyle="font-size: 10pt">(yyyymmdd)</span></td><td><asp:RequiredFieldValidatorID="RequiredFieldValidator2"runat="server"ControlToValidate="txtPackerDate"ErrorMessage="RequiredFieldValidator"Display="Dynamic">Date is required.</asp:RequiredFieldValidator></td></tr><tr><td><asp:LabelID="lblPackerOperation"runat="server"Text="Operation:"></asp:Label></td><td><asp:RadioButtonListID="rblPakerOperation"runat="server"RepeatDirection="Horizontal"><asp:ListItemSelected="True"Value="P">Pulled</asp:ListItem><asp:ListItemValue="S">Set</asp:ListItem></asp:RadioButtonList></td><td></td></tr><tr><td><asp:LabelID="lblPackerCode"runat="server"Text="Code:"></asp:Label></td><td><asp:TextBoxID="txtBoxPackerCode"runat="server"></asp:TextBox><asp:ButtonID="btnPackerCodes"runat="server"Text=".."/><ajaxToolkit:PopupControlExtenderID="PopupControlExtenderPackerCodes"runat="server"TargetControlID="btnPackerCodes"PopupControlID="PanelPackerCode"Position="Bottom"/></td><td></td></tr><tr><td><asp:LabelID="lblPackerDepth"runat="server"Text="Depth:"></asp:Label></td><td><asp:TextBoxID="txtboxPackerDepth"runat="server"MaxLength="7"></asp:TextBox>mkb<spanstyle="font-size: 10pt; color: #ff0033">*</span></td><td><asp:RequiredFieldValidatorID="RequiredFieldValidator1"runat="server"ControlToValidate="txtboxPackerDepth"ErrorMessage="RequiredFieldValidator"Display="Dynamic">Depth is required.</asp:RequiredFieldValidator></td></tr><tr><tdcolspan="3"><hr/></td></tr><tr><td><spanstyle="color: #ff0033"><spanstyle="font-size: 10pt; color: #ff0033">*</span></span>-Required</td><td></td><tdstyle="width: 100%"><asp:ButtonID="btnPackerAddOk"runat="server"Text="Ok"/><asp:ButtonID="btnCancel"runat="server"Text="Cancel"OnClick="btnCancel_Click"CausesValidation="False"/></td></tr></table></ContentTemplate></asp:UpdatePanel></asp:Panel>

</

div>

<

divid="PanelCalendarDiv"><asp:PanelID="PanelCalendar"runat="server"CssClass="popupControl"Style="z-index: 10002"><asp:UpdatePanelID="UpdatePanelCalendar"runat="server"UpdateMode="Always"><ContentTemplate><center><asp:CalendarID="Calendar1"runat="server"BackColor="White"BorderColor="#999999"CellPadding="1"DayNameFormat="Shortest"Font-Names="Verdana"Font-Size="8pt"ForeColor="Black"Width="160px"OnSelectionChanged="Calendar1_SelectionChanged"><SelectedDayStyleBackColor="#666666"Font-Bold="True"ForeColor="White"/><TodayDayStyleBackColor="#CCCCCC"ForeColor="Black"/><SelectorStyleBackColor="#CCCCCC"/><WeekendDayStyleBackColor="#FFFFCC"/><OtherMonthDayStyleForeColor="#808080"/><NextPrevStyleVerticalAlign="Bottom"/><DayHeaderStyleBackColor="#CCCCCC"Font-Bold="True"Font-Size="7pt"/><TitleStyleBackColor="#999999"Font-Size="7pt"BorderColor="Black"Font-Bold="True"/></asp:Calendar></center></ContentTemplate></asp:UpdatePanel></asp:Panel>

</

div>

<

divid="PanelPackerCodeDiv"><asp:PanelID="PanelPackerCode"runat="server"CssClass="popupControl"Style="z-index: 10003"><asp:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><asp:RadioButtonListID="RblPackerCodes"runat="server"OnSelectedIndexChanged="RblPackerCodes_SelectedIndexChanged"AutoPostBack="true"><asp:ListItemValue="1">1 - Packer</asp:ListItem><asp:ListItemValue="2">2 - Bridge plug or whipstock packer</asp:ListItem><asp:ListItemValue="3">3 - Cement retainer</asp:ListItem><asp:ListItemValue="4">4 - Through tubing packer</asp:ListItem><asp:ListItemValue="5">5 - Through tubing bridge plug</asp:ListItem></asp:RadioButtonList></ContentTemplate></asp:UpdatePanel></asp:Panel>

</

div>

<

asp:XmlDataSourceID="PackersXmlDataSource"runat="server"DataFile="~/XML/Packers.xml">

</

asp:XmlDataSource>

<

asp:ObjectDataSourceID="PackersObjectDataSource"runat="server"DataObjectTypeName="Packer"DeleteMethod="DeletePacker"SelectMethod="GetPackers"TypeName="WellOperation"UpdateMethod="UpdatePacker"></asp:ObjectDataSource>

I'm having the same problem and have tried for 2 weeks to resolve without success. I have converted to the RC AJAX - still same issue. I have suspected that the problem revolves around a custom user control that is on my form. It is simply an alphabet selector with 26 letters as links.

I have traced the events and on the first click, the code goes as far as the constructor code for the user control and then simply stops. But then, as Janet wrote, the second click works just fine.

Saturday, March 24, 2012

my javascript method not working with update panel

Hi All,

The gridview (inside a user control) i am using in my screen (.aspx page) have a Checkbox column in the end. When i click the checkbox in the header all the checkboxes are selected. (A long javascript code has been written for that in the user control)

Now I have applied a scriptmanager and update Panel on this user control, and since then the javascript which selects all the checkboxes is not working properly.

I would like to know what i can do to resolve this javascript issue. And also would like to know why using the basic tools of ASP.NET AJAX control is stopping my own javascript from firing.

Please Note: On leaving a validation on page, the page postback and shows the validation. After this the javascript of Gridview works fine.

I have tried searching on google, but was not able to find any satisfactory explanation to my problem. It would be great if you people can help me.

Thanks,

Shikha

Please post your source code.


Hi,

Thank you for your post!

It is normal when you place inline javascript in an undatepanel/

For more information and solution, seeUpdatePanel and Rendered (Inline)Javascript

It seems that the UpdatePanel essentially replaces the InnerHTML of a DIV with the delta returned from the server. If you try this yourself you will notice that any javascript elements in the html are not fired.

All javascript registered on the server-side (if you are using .NET) with the ScriptManager is put into a separate section of the returned delta. The atlas runtime obviously then loads these scripts into the document manually.

What if the returned HTML has Javascript tags already rendered in it? Nothing.:(
Such was our predicament and we had no control over the HTML that would be returned to the UpdatePanel (ReportViewer Control). Could we manually load the javascript ourselves when the UpdatePanel returns the payload? As it turns, we could.

You can create script elements on the fly and they get evaluated as you do. Atlas has the ScriptLoader object that will do it for you if your JavaScript is an external reference. Tweaking this idea we got a solution that found all the new Script elements and added them to the document.

If you have further questions,let me know.

Best Regards,

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 with CalendarExtender Control

Hi,

I'm a beginner to ASP.NET AJAX and ASP.NET itself. I have a calendar extender for a textbox and it works fine until I click the 'Submit' button in my form. Apparently in the UI the date will show but when I do an insert to my database by using the Convert.ToDateTime function first, I get thrown an exception where it says:

'The string was not recognized as a valid DateTime. Tehre is a unknown word starting at index 0'

I would like to get some help to troubleshoot this problem.

Thanks in advance,
Nick

HI, probably your date format is not correct, the calendar extender format should be the same that the database format check that both formats be mm/dd/yy or mm/dd/yyyy or mm/dd/yyyy hh:mm:ss.


Hi, apparently something was wrong with the AJAX calendar extender. I didn't realise it until I deleted it and created a new one.

Thanks for the help anyway!Smile

Cheers,
Nick