Hi Scott,
Sorry for the late late reply...
here is the code that I use
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then
setValues() --Setting basic values
SPOpType = Request.QueryString("optype")
If Not SPOpType = "" Then
getDetails()
makeVisible() --Making Panels Visible
Else
makeInvisible() --Making Panels InVisible
End If
End If
End Sub
Private Sub btnGrid_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnGrid.Click
Dim dsCompare As DataSet
SPItemNumber = integer.parse(txtEVID.Text)
SPSaleDate = date.parse(txtSDate.Text)
Try
dsCompare = db.GetCompare(SPItemNumber, SPSaleDate)
If Not dsCompare Is Nothing Then
SPDGCompare = dsCompare
dgCompare.DataSource = dsCompare
dgCompare.DataBind()
pnlCompare.Visible = True
End If
Catch ex As Exception
errLog.LogIt("Binding Compare Grid Error", ex, "")
End Try
End Sub
Private Sub getDetails()
Dim ds As DataSet
Dim dsSum As DataSet
Try
dgCompare.DataSource = SPDGCompare
dgCompare.DataBind()
Catch ex As Exception
errLog.LogIt("Binding Grid1 Error", ex, "")
End Try
Try
ds = db.GetDetails1(SPItemNumber, SPSaleDate, SAPOpType)
dgScroll.DataSource = ds
dgScroll.DataBind()
Catch ex As Exception
errLog.LogIt("Binding Grid2 Error", ex, "")
End Try
Try
dsSum = db.GetDetails2(SPItemNumber, SPSaleDate, SAPOpType)
dgSummary.DataSource = dsSum
dgSummary.DataBind()
Catch ex As Exception
errLog.LogIt("Binding Grid3 Error", ex, "")
End Try
End Sub
Public Property SPItemNumber() As integer
Get
Return viewstate("SPItemNumber")
End Get
Set(ByVal Value As integer)
ViewState("SPItemNumber") = Value
End Set
End Property
Public Property SPSaleDate() As Date
Get
Return viewstate("SPSaleDate")
End Get
Set(ByVal Value As Date)
ViewState("SPSaleDate") = Value
End Set
End Property
Public Property SPOpType() As String
Get
Return viewstate("SPOpType")
End Get
Set(ByVal Value As String)
ViewState("SPOpType") = Value
End Set
End Property
Public Property SPDGCompare() As DataSet
Get
Return viewstate("SPDGCompare")
End Get
Set(ByVal Value As DataSet)
ViewState("SPDGCompare") = Value
End Set
End Property
"Scott M." <s-***@nospam.nospamwrote in message
news:e%****************@TK2MSFTNGP02.phx.gbl...
Not yet. When you have questions of this kind, it's best to provide us
with your code (not just bits and pieces). Let's see all your code.
I think the problem is you are trying to set the property values once they
are already gone.
"stephen" <st********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Hi Scott,
I am sorry.. i do it at the click event of a button so that it sets the
values that were in the respective textboxes
e.g
SPItemNumber = integer.parse(textbox1.text)
SPSaleDate = date.parse(textbox2.text)
I set the values first then call the stp for the first Datagrid and then
bind it.... then on clicking the "HyperLink" in the datagrid postback to
the same page, call another STP (3 parameters) and bind the second
datagrid
Am i presenting the situation correctly this time,
Thanks,
Stephen
"Scott M." <s-***@nospam.nospamwrote in message
news:eL**************@TK2MSFTNGP03.phx.gbl...
>>Well what is this property a property of? And, I also don't see any
lines of code that actually call the set portion of your properties.
When are you writing this code:
SPItemNumber = something
SPSaleDate = something
"stephen" <st********@hotmail.comwrote in message
news:us******************@TK2MSFTNGP04.phx.gbl.. .
Hi Scott,
Thanks for the reply, This is my task. I take an itemnumber, saledate
retieve all info (there can be multiple values) and display it on a
grid. then the user can click on a specific value and now I take the
values again (this time 3 values... itemnumber, saledate and OpType)
and retieve info and display on another grid.
So the first time a user inputs itemnumber and saledate.. and clicks
the button I store it in properties like this
Public Property SPItemNumber() As integer
Get
Return viewstate("SPItemNumber")
End Get
Set(ByVal Value As integer)
ViewState("SPItemNumber") = Value
End Set
End Property
Public Property SPSaleDate() As Date
Get
Return viewstate("SPSaleDate")
End Get
Set(ByVal Value As Date)
ViewState("SPSaleDate") = Value
End Set
End Property
I set it when i user clicks the button to get the information
(firstDatagrid) and this has a itemtemplate like this
<asp:TemplateColumn HeaderText="Op Type"
ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:HyperLink runat="server" id="OPLink" text='<%#
DataBinder.Eval(Container.DataItem, "optype") %>' NavigateUrl='<%#
"default.aspx?optype=" & Container.DataItem("optype") %>' />
</ItemTemplate>
</asp:TemplateColumn>
but it clears out when I click on the link.... i know it posts to the
same page... but why does the property value cleared?
Thanks,
Stephen
"Scott M." <s-***@nospam.nospamwrote in message
news:uF****************@TK2MSFTNGP05.phx.gbl. ..
Can you be more specific? What properties of what objects are you
setting? How are you setting them? When are you setting them?
>
>
"stephen" <st********@hotmail.comwrote in message
news:u2****************@TK2MSFTNGP04.phx.gbl.. .
>Hi,
>>
>I make use of properties to store values that are relevant to the
>page but this time I am posting the page to itself and the values are
>Zero or null (they disappear). is there any other way I can store
>them/preserve them so that when I post back I can use the values.
>I tried session and it works but some other ideas would be helpful.
>>
>Appreciate your help,
>Stephen
>>
>
>