dont know whats happening.... plz help
hi i am using asp.net..
in my aspx file i have declared this code in the page directive for output cache
Code:
<%@ Outputcache duration="60" varybyparam="state" %>
i have added this table to my aspx page i also have a datagrid
VB Code:
<table cellspacing="0" cellpadding="3" rules="all" style="BORDER-LEFT-COLOR:black;BORDER-BOTTOM-COLOR:black;WIDTH:700px;BORDER-TOP-COLOR:black;BORDER-COLLAPSE:collapse;BACKGROUND-COLOR:#aaaadd;BORDER-RIGHT-COLOR:black">
<tr>
<td><a href="webform1.aspx?state=germany">germany</a></td>
<td><a href="webform1.aspx?state=mexico">mexico</a></td>
<td><a href="webform1.aspx?state=uk">uk</a></td>
<td><a href="webform1.aspx?state=sweden">sweden</a></td>
<td><a href="webform1.aspx?state=canada">canada</a></td>
<td><a href="webform1.aspx?state=france">france</a></td>
<td><a href="webform1.aspx?state=italy">italy</a></td>
<td><a href="webform1.aspx?state=portugal">portugal</a></td>
</tr>
</table>
in my aspx.vb file i have this code
VB Code:
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
querystate = Request.QueryString("state")
If querystate Is Nothing Then
str = "SELECT * From Customers"
Else
str = "SELECT * From Customers Where Customers.Country= ' " + querystate + " ' "
End If
Dim adapt As New OleDbDataAdapter(str, myconn)
Dim ds As New DataSet
adapt.Fill(ds, "Customers")
DataGrid1.DataSource = ds.Tables("customers").DefaultView
DataGrid1.DataBind()
End Sub
when the page loads my datagrid populates and even my table but
when i am clicking a link from the table which i have in the aspx file nothing shows up in my datagrid .. i have been on this for hours and dont know why.. can someone please explain this to me .. thanks guys... :)
Re: dont know whats happening.... plz help
Okay try putting in something like this just inside your Page_Load()
VB Code:
Response.Write(":" & Request.QueryString("state") & ":")
Re: dont know whats happening.... plz help
hi thanks.. it worked fine i added it like this
VB Code:
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
querystate = Request.QueryString("state")
If querystate Is Nothing Then
str = "SELECT * From Customers"
Else
str = "SELECT * From Customers Where Customers.Country= '" & Request.QueryString("state") & "'"
End If
Dim adapt As New OleDbDataAdapter(str, myconn)
Dim ds As New DataSet
adapt.Fill(ds, "Customers")
DataGrid1.DataSource = ds.Tables("customers").DefaultView
DataGrid1.DataBind()
End Sub
just one quick question i would like to ask... why wasnt it not working for me when i was putting the variable querystring equal to the sql statement meaning like this.. thanks in advance... :)
VB Code:
querystate = Request.QueryString("state")
If querystate Is Nothing Then
str = "SELECT * From Customers"
Else
str = "SELECT * From Customers Where Customers.Country= '" & Request.QueryString("state") & "'"
End If