I'm using the page name to select data from a sql datasource:
<asp:SqlDataSource ID="myDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:myConn %>" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [myTable] WHERE ([WebPageName] = ?)" OnSelecting="SqlDataSource1_Selecting"> <SelectParameters> <asp:Parameter Name="WebPageName" Type="String" /> </SelectParameters> </asp:SqlDataSource>
(where myTable contains the column "WebPageName" which holds the page filenames)
The WebPageName parameter is obtained from code behind:
Protected Sub SqlDataSource1_Selecting(ByVal sender As Object, ByVal e As SqlDataSourceSelectingEventArgs) e.Command.Parameters.Add("WebPageName") e.Command.Parameters(&quo ...

Go to the complete details ...