Groups > Asp .Net > Visual Web Developer 2005 Express > Re: Getting a dropdownlist to show all of an employees checks and




Getting a dropdownlist to show all of an employees checks
and

Getting a dropdownlist to show all of an employees checks and
Wed, 19 Mar 2008 17:48:37 +000
Then clicking one of the 'checks' to have a datagrid pull up the whole record.

That is what I'm trying to do. The employee may have many checks. I can get the
employee ID to find all the checks, but displaying everyone would just not be
practical. I need to display the informaton of just one check on the screen at a
time.

I understand I can get SQL to load a dropdownlist with the checks 'key' and then
select from there. Is this possible?

 Thanks.
Post Reply
Re: Getting a dropdownlist to show all of an employees checks and
Wed, 19 Mar 2008 18:04:55 +000
Yes.. It is possible. But the only catch here is you dont need a grid to display
the information. If you are trying to display single record [check] information
then either make use of DetailsView or FormView controls.

check this link on how to use details view

 

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/detailsview.asp
x
Post Reply
Re: Getting a dropdownlist to show all of an employees checks and
Wed, 19 Mar 2008 20:16:34 +000
I plan on using a Detail View. It's passing the key to the next screen so the
detail view "see's'" the key to pick up the record.

Thanks.
Post Reply
Re: Getting a dropdownlist to show all of an employees checks and
Wed, 19 Mar 2008 20:19:24 +000
<%@PageLanguage="VB" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD
XHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.
dtd">

<scriptrunat="server"></script>
<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server"><title>Untitled Page</title>
</head>

<body>

<formid="form1"runat="server">

<div>

<asp:DropDownListID="DropDownList1"runat="server"AutoPost
Back="True"DataSourceID="SqlDataSource1"

DataTextField="employeeName"DataValueField="employeeId"Style
="position: relative">

</asp:DropDownList>

<asp:SqlDataSourceID="SqlDataSource1"runat="server"Connec
tionString="<%$ ConnectionStrings:yourConnectionString %>"

SelectCommand="SELECT [employeeId], [employeeName] FROM
yourEmployeeTable"></asp:SqlDataSource>

<br/>

<asp:GridViewID="GridView1"runat="server"AutoGenerateColu
mns="False"DataSourceID="SqlDataSource2"

Style="position: relative">

<Columns>

<asp:BoundFieldDataField="column1"HeaderText="column1"Sor
tExpression="column1"/>

<asp:BoundFieldDataField="column2"HeaderText="column2"Sor
tExpression="column2"/>

</Columns>

</asp:GridView>

<asp:SqlDataSourceID="SqlDataSource2"runat="server"Connec
tionString="<%$ ConnectionStrings:yourConnectionString %>"

SelectCommand="SELECT [column1], [column2] FROM yourCheckTable WHERE
([employeeId] = @employeeId)">

<SelectParameters>

<asp:ControlParameterControlID="DropDownList1"Name="employeeId
"PropertyName="SelectedValue"

Type="String"/>

</SelectParameters>

</asp:SqlDataSource>

 

</div></form> </body>

</html>
Post Reply
about | contact