This is best handled using DataSource events directly, rather than PageLoad events.
To set the QueryString to Select, add this to your data source:
<SelectParameters>
<asp:QueryStringParameter Name="StoreID" QueryStringField="StoreID" Type="Int64" />
</SelectParameters>
This indicates that the DataSource Select searches for “StoreID = x” in the QueryString and sets the value of “StoreID” to “x” from the URL as you mentioned.
To set the default value for StoreID, connect to the data source selection event as follows:
Protected Sub SD1DataSource_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SD1DataSource.Selecting
If e.Command.Parameters("@StoreID").Value Is Nothing Then
e.Command.Parameters("@StoreID").Value = 155
End If
End Sub
: , .