Hey everyone,

So I am new to this whole encapsulated datasource thing and I am having trouble with passing a variable (example a search). I got it working by doing this...

Aspx
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Text="Label" Width="490px"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DISConnectionString %>"
            SelectCommand="CaseDocSelectCommand" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:Parameter DefaultValue="00-0001" Name="csNumber" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
       
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="CASE_NUMBER" HeaderText="CASE_NUMBER" SortExpression="CASE_NUMBER" />
                <asp:BoundField DataField="CASE_DESCRIPTION" HeaderText="CASE_DESCRIPTION" SortExpression="CASE_DESCRIPTION" />
                <asp:BoundField DataField="CASE_INDUSTRY_CODE" HeaderText="CASE_INDUSTRY_CODE" SortExpression="CASE_INDUSTRY_CODE" />
                <asp:BoundField DataField="DOCUMENT_DATE_FILED" HeaderText="DOCUMENT_DATE_FILED"
                    SortExpression="DOCUMENT_DATE_FILED" />
                <asp:BoundField DataField="DOCUMENT_ID" HeaderText="DOCUMENT_ID" SortExpression="DOCUMENT_ID" />
                <asp:BoundField DataField="DOCUMENT_NUMBER_OF_PAGES" HeaderText="DOCUMENT_NUMBER_OF_PAGES"
                    SortExpression="DOCUMENT_NUMBER_OF_PAGES" />
                <asp:BoundField DataField="DOCUMENT_SUMMARY" HeaderText="DOCUMENT_SUMMARY" SortExpression="DOCUMENT_SUMMARY" />
            </Columns>
        </asp:GridView>
    </div>
    </form>
</body>
</html>
aspx.vb
Code:
Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        
        Me.SqlDataSource1.SelectParameters(0).DefaultValue = Me.TextBox1.Text
        

    End Sub
End Class
Now although this is dirty it does work but isn't there a better more standard way of passing a parameter? I would think there has to be. If anyone can help it would be awesome.

Jackie