Ok, so i'm trying to build a website with 2 search fields for the 2 parameters in the following stored procedure and use them to search, i followed an online tutorial i found, the stored procedure is the following:
CREATE PROC Original_Content_Search
@typename VARCHAR(20),
@categoryname VARCHAR(20)
AS
IF @typename is NULL
SELECT *
FROM Original_Content OC INNER JOIN Content C ON OC.id=C.id
WHERE OC.filter_status=1 and OC.review_status=1 and
C.category_type=@categoryname
ELSE
SELECT OC.*
FROM Original_Content OC INNER JOIN Content C ON OC.id=C.id
WHERE OC.filter_status=1 and OC.review_status=1 and C.[type]=@typename
The procedure works as I've tried running it through a query and it worked fine, now I'm trying to use the following based on the tutorial I followed to build a grid from a search but it's just refreshing the page when I click search
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<div>
Search Original Content:
<br />
Search By Type: <asp:TextBox ID="typeSearch" runat="server"></asp:TextBox>
<br />
Search By Category: <asp:TextBox ID="categorySearch" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnSearch" runat="server" Text="Search" />
<hr />
<asp:GridView ID="GridView1" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White"
runat="server" AutoGenerateColumns="false" DataSourceID="GridDataSource" AllowPaging="true">
<Columns>
<asp:BoundField DataField="id" HeaderText="ID" ItemStyle-Width="150" />
<asp:BoundField DataField="content_manager_id" HeaderText="Content Manager ID" ItemStyle-Width="150" />
<asp:BoundField DataField="reviewer_id" HeaderText="Reviewer ID" ItemStyle-Width="150" />
<asp:BoundField DataField="review_status" HeaderText="Review Status" ItemStyle-Width="150" />
<asp:BoundField DataField="filter_status" HeaderText="Filter Status" ItemStyle-Width="150" />
<asp:BoundField DataField="rating" HeaderText="Rating" ItemStyle-Width="150" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="GridDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConStr %>"
SelectCommand="Original_Content_Search" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter Name="typename" ControlID="typeSearch" PropertyName="Text" DefaultValue="" ConvertEmptyStringToNull="true" />
<asp:ControlParameter Name="categoryname" ControlID="categorySearch" PropertyName="Text" DefaultValue="" ConvertEmptyStringToNull="true" />
</SelectParameters>
</asp:SqlDataSource>
</div>
</asp:Content>
This as I said only refreshes the page, I'm assuming I need to link the button with the search somehow? or how am I supposed to get this to work? many thanks