Help ASP Coder - Search form display results in gridview
am 16.11.2007 19:38:40 von dakota64Hello All, I am an asp coder trying to do .net. I think i have a
simple problem, but I cannot find a solution to this anywhere. Here
is what I have.
I have one aspx page with a multiview that contains 2 views. View1
has 3 text boxes that a user can enter search parameters. View2 has a
gridview with a sqldatasource bound to it to display the results. I
cannot figure out how to execute the sql statement so it will populate
the gridview. Here is my code:
aspx Page:
<%@ Page Language="VB" MasterPageFile="~/MPMain.master"
AutoEventWireup="false" CodeFile="SecuritySearch.aspx.vb"
Inherits="Admin_SecuritySearch" title="Untitled Page" %>
Security Search
ForeColor="Red" Text="Label">
td>
First Name:
Last Name:
asp:TextBox>
Alias:
asp:TextBox>
View 2
SelectCommand="SELECT [FULL_NAME_SFI], [JOBTITLE],
[DEPARTMENT_NAM_SFI], [EMAIL_ALIAS_SFI]
FROM [0002_SFVW]
WHERE (([EMAIL_ALIAS_SFI] = @EMAIL_ALIAS_SFI)
or
(([FIRST_NAME] LIKE '%' + @FIRST_NAME + '%')
AND ([LAST_NAME] LIKE '%' + @LAST_NAME + '%')))
ORDER BY [FIRST_NAME], [LAST_NAME]">
Type="String" />
PropertyName="Text" Type="String" />
Type="String" />
Code Behind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Me.MultiView1.ActiveViewIndex = 0
End Sub
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSearch.Click
Me.MultiView1.ActiveViewIndex = 1
Me.GridView1.DataBind()
End Sub