Groups > Asp .Net > Visual Web Developer 2005 Express > Re: need help on vb2005 about control two id at same time~whch is dropdownlist and textbox




need help on vb2005 about control two id at same time~whch
is dropdownlist and textbox

need help on vb2005 about control two id at same time~whch is dropdownlist and textbox
Tue, 18 Mar 2008 14:03:00 +000
k~ i need help from here..my case is like tis..i did using the tis express
edition to create a addressbook..let say my database name is employee.mdf...and
i drag a dropdownlist,textbox,button and gridview on my page design. what i want
is when i choose a field from dropdownlist(such as employee name or employee
id), same time i key in the name of the employee that i want to look for his
details and the gridview will retrieve the info from database for the employee i
requested..i try using the control id in sqldatasource~but it only allow me
control between dropdownlist o textbox(only can control either 1)so what shud i
do to make it able to filter by dropdownlist 1st only control by textbox..and
display result in gridview?...any idea on select command?o dropdownlist coding?


P/S:the command of sql i wrote like tis

SELECT * FROM Employee

WHERE EmployeeName =@abc

so is dat possible i add in code in tis to make it filter by dropdownlist 1st?
Post Reply
Re: need help on vb2005 about control two id at same time~whch is dropdownlist and textbox
Thu, 20 Mar 2008 02:43:41 +000
k ~~i solve my problem already~if who did encounter problem as me cna have a 
look on my code..it's work fine for me...hope it helps~thx anyway~

 

 <asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT EmployeeName, EmployeeID, Position,
Department, Extension, Email, HomePhone, HandPhone FROM Employee WHERE
(EmployeeName LIKE '%' + @EmployeeName + '%') OR (EmployeeID LIKE N'%' +
@EmployeeID + N'%') OR (Department LIKE '%' + @Department + '%') OR (Extension
LIKE '%' + @Extension + '%') OR (Email LIKE '%' + @Email + '%')"
FilterExpression=" LIKE '%%'">
           <FilterParameters>
                <asp:ControlParameter ControlID="DropDownList1"
Name="FieldToSearch" PropertyName="SelectedValue" />
                <asp:ControlParameter ControlID="TextBox1"
Name="Search Criteria" PropertyName="Text" />
            </FilterParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="TextBox1"
Name="EmployeeName" PropertyName="Text" />
                <asp:ControlParameter ControlID="TextBox1"
Name="EmployeeID" PropertyName="Text" />
                <asp:ControlParameter ControlID="TextBox1"
Name="Department" PropertyName="Text" />
                <asp:ControlParameter ControlID="TextBox1"
Name="Extension" PropertyName="Text" />
                <asp:ControlParameter ControlID="TextBox1"
Name="Email" PropertyName="Text" />
            </SelectParameters>
Post Reply
about | contact