troubleshooting Question

ASP.NET VB GridView search display on alternate page in Sharepoint 3

Avatar of Britt Thompson
Britt ThompsonFlag for United States of America asked on
ASP.NETMicrosoft SharePointVisual Basic.NET
3 Comments1 Solution1005 ViewsLast Modified:
Currently, I have a simple GridView search setup on a page within my Sharepoint site. It's very basic (code is attached).

What I need to do is have a small web part on the home page with a small search field and a search button that displays the results on the existing search page. I'm not sure what the easiest way to accomplish this is since my current search does not use query strings.

I'm up for any recommendations. Thanks.
<%@ Page masterpagefile="~masterurl/default.master" language="vb" AutoEventWireup="false" title="|" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document" %>
<asp:Content id="Content1" runat="server" contentplaceholderid="PlaceHolderAdditionalPageHead">
	<link rel="stylesheet" type="text/css" href="../../layout.css">
	<script runat="server">

    Dim SearchString As String = ""

    Protected Sub btnClear_Click(ByVal sender As Object, ByVal e As  _
            System.EventArgs)
        ' Simple clean up text to return the Gridview to it's default state
        txtSearch.Text = ""
        SearchString = ""
        Gridview1.DataBind()
    End Sub

    Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As  _
            System.EventArgs)
        ' Set the value of the SearchString so it gets 
        SearchString = txtSearch.Text
    End Sub
    
 </script>
</asp:Content>
	
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
	SERVER IT/AT - COMPANY Projects
</asp:Content>

<asp:Content id="Content2" runat="server" contentplaceholderid="PlaceHolderMain">
	<asp:TextBox ID="txtSearch" runat="server"/>
    <asp:Button ID="btnSearch" OnClick="btnSearch_Click" runat="server" Text="Search"/>
	<asp:Button ID="btnClear" OnClick="btnClear_Click" runat="server" Text="Clear"/><br /><br />
	<asp:GridView runat="server" id="GridView1" AutoGenerateColumns="False" DataSourceID="VWvisProjects" width="100%" BorderWidth="0px" GridLines="None" AllowPaging="True" PageSize="200">
								<Columns>
												
												<asp:boundfield DataField="projectno" HeaderText="Project Number" ReadOnly="True" SortExpression="projectno">
												</asp:boundfield>
												<asp:boundfield DataField="fullnumber" HeaderText="Full Number" ReadOnly="True" SortExpression="fullnumber">
												</asp:boundfield>
												<asp:boundfield DataField="Name" HeaderText="Name" SortExpression="Name">
												</asp:boundfield>
												<asp:boundfield DataField="PrincipalName" HeaderText="Principal Name" ReadOnly="True" SortExpression="PrincipalName">
												</asp:boundfield>
												<asp:boundfield DataField="ProjManagerName" HeaderText="Project Manager Name" ReadOnly="True" SortExpression="ProjManagerName">
												</asp:boundfield>
								</Columns>
								<FooterStyle BackColor="Tan" />
								<HeaderStyle CssClass="ms-vh" />
        <RowStyle CssClass="ms-vb" />
        <AlternatingRowStyle CssClass="ms-vb ms-alternating" />
        <PagerStyle  CssClass="pagerstyle"/>
				</asp:GridView>
				<asp:SqlDataSource runat="server" ID="VWvisProjects" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=SERVER;Initial Catalog=COMPANY;User ID=sa;Password=password" SelectCommand="SELECT [projectno], [fullnumber], [Name], [PrincipalName], [ProjManagerName] FROM [VWvisProjects] ORDER BY [projectno], [fullnumber]"
				    FilterExpression="projectno like '%{0}%' or name like '%{1}%' or fullnumber like '%{2}%' or ProjManagerName like '%{3}%' or PrincipalName like '%{4}%'">
    <FilterParameters>
        <asp:ControlParameter Name="projectno" ControlID="txtSearch" PropertyName="Text" />
        <asp:ControlParameter Name="name" ControlID="txtSearch" PropertyName="Text" />
        <asp:ControlParameter Name="fullnumber" ControlID="txtSearch" PropertyName="Text" />
        <asp:ControlParameter Name="ProjManagerName" ControlID="txtSearch" PropertyName="Text" />
        <asp:ControlParameter Name="PrincipalName" ControlID="txtSearch" PropertyName="Text" />
    </FilterParameters>

				</asp:SqlDataSource>
</asp:Content>
<asp:Content id="Content3" runat="server" contentplaceholderid="PlaceHolderPageTitleInTitleArea">

		  COMPANY Projects</asp:Content>
ASKER CERTIFIED SOLUTION
carlnorrbom

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros