DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 03 Aug 2007 12:47:16 -0000,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    justin


FormView problems   
Hello, I am having problems modifying controls that are in a FormView.
What I am trying to do with the code below is show a TextBox and a
Calendar in a FormView. When the user changes the selected date in the
calendar the new date should show in the TextBox (this is a slimmed
down version of my end product to help simplify what I am showing).

<asp:FormView ID="FormView1" DefaultMode="Edit" runat="server"
Height="249px" DataSourceID="someDataSource"
OnPageIndexChanging="FormView1_PageIndexChanging" Width="290px">
   <EditItemTemplate>
          <asp:Calendar ID="Calendar2" runat="server"
OnSelectionChanged="Calendar2_SelectionChanged">
          </asp:Calendar>
          <asp:TextBox ID="textbox1" runat="server" Text ="asdfasdf"></
asp:TextBox>
   </EditItemTemplate>
</asp:FormView>

protected void Calendar2_SelectionChanged(object sender, EventArgs e)
{
    Calendar toAccess = (Calendar)FormView1.FindControl("Calendar2");
    TextBox toShow = (TextBox)FormView1.FindControl("textbox1");

    //get new selected date
    DateTime theNewTime = toAccess.SelectedDate;

    //set the textbox to show the new date
    toShow.Text = theNewTime.ToString();

    //test code to verify results
    Response.Write(toShow.Text);
}

When I change the selection in the Calendar I can obtain the new value
fine, find the TextBox control fine, set the TextBox.Text property
fine and the print statement prints the value that should end up in
the TextBox. The problem is that the value never shows up in the
TextBox.

I think my problem might be in the sequence of events for an ASP.NET
page. Can anyone either provide a better way to access a control that
is in a FormView or suggest a whole different approach? Thanks.
Date:Fri, 03 Aug 2007 12:47:16 -0000   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us