A1VBCode Forums

how to count no. of days between code in asp.net (aspx.cs)


http://www.a1vbcode.com/vbforums/Topic27934.aspx

By anandbe21 - 7/23/2009

Hi All,

1.Anybody help regarding my requirements i wanted codebehind page(aspx.cs) i need to count no. of days between From date and to date which i am passing in my frontend application txtfromdate,txttodate i need to count number of days between those dates which was comming from Frontend (txtfromdate,txttodate)any code regarding this.

2.After getting count of no. of days b/w From date,todate i need substract from getting days(b/w fromdate,td) to no. of leaves(employyess)after this ineed to bind to gridview control after substract value will pass to gridview control.

Regards
ANAND.

By michael123 - 3/24/2010

Hi,It appears you are referencing an empty viewstate(object = nothing).



Try this....



If ViewState("VarName") ISNOT Nothing THen

'Do your stuff

TextBox1.Text = ViewState("VarName").ToString()

Else

'ViewState = Nothing

'Reset your viewstate...

SCOPE: it is only good for the life of the PAGE....redirect to same page sets it to nothing

End IF



If this doesn't solve it, strip your code down and paste it in the forum and I'll see if I can help out.