Click here to Skip to main content
15,895,142 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Windows Service in ASP.NET Pin
RichardGrimmer4-Jul-06 3:07
RichardGrimmer4-Jul-06 3:07 
QuestionSession Terminate abnormaly [modified] Pin
Masood Ahmed30-Jun-06 17:07
Masood Ahmed30-Jun-06 17:07 
QuestionExtend Atlas [modified] Pin
YossiKahlon30-Jun-06 13:12
YossiKahlon30-Jun-06 13:12 
AnswerRe: Extend Atlas Pin
minhpc_bk30-Jun-06 17:37
minhpc_bk30-Jun-06 17:37 
GeneralRe: Extend Atlas Pin
YossiKahlon1-Jul-06 0:10
YossiKahlon1-Jul-06 0:10 
Questionlongitude & latitude (Urgent) Pin
kirthikirthi30-Jun-06 9:48
kirthikirthi30-Jun-06 9:48 
AnswerRe: longitude & latitude (Urgent) [modified] Pin
eggsovereasy30-Jun-06 9:51
eggsovereasy30-Jun-06 9:51 
QuestionViewstate within a control Pin
Lord Nelly30-Jun-06 9:22
Lord Nelly30-Jun-06 9:22 
Hi Everyone,

I have built a control which is a special calendar object. You can click once on a start date, then once on an end date and the range is filled in. The control works fine in it's own right, however, the page that contains the control doesn't seem to pull out the viewstate data from the control.

The viewstate is read in the control's Load event as below:

Partial Class Controls_Calendar
Inherits System.Web.UI.UserControl

Private m_MonthView As Integer
Private m_YearView As Integer
Private m_ArrivalDate As Date
Private m_DepartureDate As Date

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If ViewState.Item("MonthView") Is Nothing Then
ViewState.Add("MonthView", Date.Now.Month)
Me.m_MonthView = Date.Now.Month
Else
Me.m_MonthView = ViewState.Item("MonthView")
End If

If ViewState.Item("YearView") Is Nothing Then
ViewState.Add("YearView", Date.Now.Year)
Me.m_YearView = Date.Now.Year
Else
Me.m_YearView = ViewState.Item("YearView")
End If

If ViewState.Item("ArrivalDate") Is Nothing Then
Me.m_ArrivalDate = Nothing
Else
Me.m_ArrivalDate = ViewState.Item("ArrivalDate")
End If

If ViewState.Item("DepartureDate") Is Nothing Then
Me.m_DepartureDate = Nothing
Else
Me.m_DepartureDate = ViewState.Item("DepartureDate")
End If

If Not Page.IsPostBack Then
RenderCalendars()
End If
End Sub


The page tries to read the viewstate info:

Partial Class Pages_BookAccommodation_BookGlasgowAccommodation
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Trace.Write("Viewstate", ViewState.Item("ArrivalDate"))
If Not ViewState.Item("ArrivalDate") Is Nothing Then
Trace.Write("Viewstate", ViewState.Item("ArrivalDate"))
Me.lblFrom.Text = ViewState("ArrivalDate").ToString & " (2pm)"
End If
If Not ViewState("DepartureDate") Is Nothing Then
Me.lblTo.Text = ViewState("DepartureDate").ToString & " (10am)"
End If
End Sub


I have tried PreRender event as well to read the viewstate from the page codebehind but no success. The trace shows nothing.

Also, it might be worth mentioning that the page uses a master page???

Can any .net genius tell me where I might be going wrong?

Nelly.
AnswerRe: Viewstate within a control Pin
minhpc_bk30-Jun-06 17:04
minhpc_bk30-Jun-06 17:04 
GeneralRe: Viewstate within a control Pin
Lord Nelly1-Jul-06 5:46
Lord Nelly1-Jul-06 5:46 
GeneralRe: Viewstate within a control Pin
minhpc_bk1-Jul-06 8:42
minhpc_bk1-Jul-06 8:42 
QuestionWorking With AJAX Pin
ravindradonkada30-Jun-06 8:28
ravindradonkada30-Jun-06 8:28 
AnswerRe: Working With AJAX Pin
YossiKahlon30-Jun-06 13:15
YossiKahlon30-Jun-06 13:15 
GeneralRe: Working With AJAX Pin
RichardGrimmer4-Jul-06 3:09
RichardGrimmer4-Jul-06 3:09 
AnswerRe: Working With AJAX Pin
Tirthadip30-Jun-06 19:08
Tirthadip30-Jun-06 19:08 
QuestionHow to Restrict Selected Webforms Pin
ravindradonkada30-Jun-06 8:07
ravindradonkada30-Jun-06 8:07 
AnswerRe: How to Restrict Selected Webforms Pin
minhpc_bk30-Jun-06 17:07
minhpc_bk30-Jun-06 17:07 
QuestionASP.NET Menu is flaky Pin
gantww30-Jun-06 8:03
gantww30-Jun-06 8:03 
AnswerRe: ASP.NET Menu is flaky - now I'm more confused Pin
gantww30-Jun-06 8:17
gantww30-Jun-06 8:17 
GeneralRe: ASP.NET Menu is flaky - now I'm more confused Pin
gantww30-Jun-06 10:11
gantww30-Jun-06 10:11 
QuestionIndex 0 is not non-negative ! Pin
xuzia30-Jun-06 7:44
xuzia30-Jun-06 7:44 
AnswerRe: Index 0 is not non-negative ! Pin
Dustin Metzgar30-Jun-06 8:02
Dustin Metzgar30-Jun-06 8:02 
AnswerRe: Index 0 is not non-negative ! Pin
Guffa30-Jun-06 8:04
Guffa30-Jun-06 8:04 
QuestionCalender control using jscript Pin
Arun Hegde30-Jun-06 7:14
Arun Hegde30-Jun-06 7:14 
AnswerRe: Calender control using jscript Pin
minhpc_bk30-Jun-06 17:18
minhpc_bk30-Jun-06 17:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.