Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 8th, 2008, 12:01 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Your ODS probably gets the data again, based on the new calendar settings.

Can't you simply move RefreshCalendar to after the databinding, in an event fired by the GridView or ODS?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old July 8th, 2008, 12:39 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default

You're absolutely right! I was stopping the debug too early and the MemberManager is getting called again (not entirely sure why - other than I'm sure with timing and the way the ODS is set up, it's calling it's own databind after the dates have been set up - probably exactly what you just said in fewer words).

So--how can I tie into an event that I know will be called after the databinding has occured? What event would I want to call to refresh the calendar with the dates?

Thanks,
Rob

(added later - or I can leave it with what is working - by leaving as below--but not sure why that is working now and thoroughly confused)

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
        Dim selectedDate As Date
        selectedDate = Calendar1.SelectedDate
        Dim month As Integer = selectedDate.Month
        Dim year As Integer = selectedDate.Year

        RefreshCalendar(Calendar1, month, year)
        ObjectDataSource1.SelectParameters.Clear()
        ObjectDataSource1.SelectParameters.Add("myDate", selectedDate.ToString)


    End Sub
 
Old July 8th, 2008, 12:44 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Exactly. By calling DataBind, you force the databinding mechanism. However that doesn't stop the framework from doing its normal thing: get your data based on the selected date in the calendar.

What about handing OnSelected on the ODS or OnDataBound on the GridView?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old July 8th, 2008, 02:59 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default

Imar,

Thank you - I will try that as soon as I get home---can you help out with one of the first questions I actually had in this thread - what is the syntax for programatically setting a parameter in the objectdatasource?

I know it's not objectDataSourc1.SelectParameters.Add - as the "Add" will add to the collection.

Thanks,
Rob

 
Old July 8th, 2008, 03:03 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I already answered that; check out the link I posted and look at DefaultValue....

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old July 9th, 2008, 01:44 AM
Registered User
 
Join Date: Jul 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Valuable resources


Quote:
quote:Originally posted by Imar
 You'd be surprised what a good Google search gives you. Searching for:

assign value parameter objectdatasource

gives you articles like this:

http://bytes.com/forum/thread480440.html

which shows you how to use the DefaultValue.

However, I still think simply calling DataBind should work as well. If you call DataBind, the databinding process starts again and the controls should be able to figure out the changed date on the Calendar1 control.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Chandan
Imfinity India Pvt. Ltd.





Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView binding with Arraylist myself.panku .NET Framework 2.0 2 November 5th, 2008 05:52 AM
binding GridView at runtime! veda Visual Studio 2005 3 August 4th, 2008 06:44 AM
Gridview problem in Binding ndramkumar ASP.NET 2.0 Professional 1 September 2nd, 2007 11:45 PM
Binding dropdownlist to gridView mcgarry101 ASP.NET 2.0 Basics 0 February 13th, 2007 07:12 AM
Binding fields on a gridview aldwinenriquez ASP.NET 2.0 Professional 0 June 1st, 2006 07:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.