Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > event sequence

Reply
Thread Tools

event sequence

 
 
=?Utf-8?B?RGFiYmxlcg==?=
Guest
Posts: n/a
 
      07-17-2006
I have a calendar control and a formview control on the same page. Based on
wether I have data for the calendar day of the SelectionChanged event, I want
to change the FormView to the correct mode, insert or edit. I can't figure
out how to make this happen and am not sure when I should set the FormView
mode and rebind it.

Thanks for any help on this.

protected void calRideCounts_selectionChanged( object sender, EventArgs e ) {
FillRideCountsDataset();
bool found = false;
if ( dsRideCounts != null && dsRideCounts.Tables.Count > 0 ) {
foreach ( DataRow dr in dsRideCounts.Tables[0].Rows ) {
DateTime rideDate = (DateTime)dr["RideDate"];
if ( rideDate == calRideCounts.SelectedDate ) {
// need to set FormView from insert to edit mode
found = true;
}
}
}
DateTime dt = calRideCounts.SelectedDate;
if ( found ) {
fvRideCounts.DefaultMode = FormViewMode.Edit;
fvRideCounts.DataBind();
}

TextBox tb = (TextBox)fvRideCounts.FindControl( "tbRideDate" );
tb.Text = String.Format( "{0:MMMM dd}", dt );
}

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Y2xpY2tvbg==?=
Guest
Posts: n/a
 
      07-17-2006
Don't try to change the mode of the formview by setting the DefaultView
property, instead use the ChangeMode method as follows:

FormView.ChangeMode(FormViewMode.Edit);

or

FormView.ChangeMode(FormViewMode.Insert);

or

FormView.ChangeMode(FormViewMode.ReadOnly);

"Dabbler" wrote:

> I have a calendar control and a formview control on the same page. Based on
> wether I have data for the calendar day of the SelectionChanged event, I want
> to change the FormView to the correct mode, insert or edit. I can't figure
> out how to make this happen and am not sure when I should set the FormView
> mode and rebind it.
>
> Thanks for any help on this.
>
> protected void calRideCounts_selectionChanged( object sender, EventArgs e ) {
> FillRideCountsDataset();
> bool found = false;
> if ( dsRideCounts != null && dsRideCounts.Tables.Count > 0 ) {
> foreach ( DataRow dr in dsRideCounts.Tables[0].Rows ) {
> DateTime rideDate = (DateTime)dr["RideDate"];
> if ( rideDate == calRideCounts.SelectedDate ) {
> // need to set FormView from insert to edit mode
> found = true;
> }
> }
> }
> DateTime dt = calRideCounts.SelectedDate;
> if ( found ) {
> fvRideCounts.DefaultMode = FormViewMode.Edit;
> fvRideCounts.DataBind();
> }
>
> TextBox tb = (TextBox)fvRideCounts.FindControl( "tbRideDate" );
> tb.Text = String.Format( "{0:MMMM dd}", dt );
> }
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to iterate over sequence and non-sequence ? stef mientki Python 13 10-20-2007 10:21 AM
question about event sequence for Page_Load and Menu1_MenuItemClic =?Utf-8?B?SmF5?= ASP .Net 3 12-21-2005 07:07 PM
Event Sequence Wrong Josh ASP .Net 1 08-17-2005 11:22 AM
PostBack Event Firing Sequence Guadala Harry ASP .Net 3 08-15-2004 07:42 AM
BOOT SEQUENCE (how to change boot sequence) bird Computer Support 13 12-24-2003 02:20 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57