Hi Guru's,
I am new to asp.net!
I can create a repeater control but would like to add a select list to
it as follows:
<%@dotnet.itags.org. Page Language="vb" debug=true %>
<%@dotnet.itags.org. import Namespace="System.Data" %>
<%@dotnet.itags.org. import Namespace="System.Data.SqlClient" %>
<script runat="server"
Sub Page_Load(sender As Object, e As EventArgs)
Dim myConnection As SqlConnection
Dim myCommand As SqlDataAdapter
myConnection = New SqlConnection("server=local;user
id=whocares;database=dbSeekersClientApp;Trusted_Co nnection=false")
myCommand = New SqlDataAdapter("SELECT ID, username, password,
firstname, surname, account_live FROM t_managers", myConnection)
Dim ds As Dataset = new DataSet()
myCommand.Fill(ds)
MyRepeater.DataSource = ds
MyRepeater.DataBind()
End SUb
</script>
<html>
<head>
</head>
<body
<form action="intro1.aspx" method="post" runat="server"
<ASP:Repeater id="MyRepeater" runat="server">
<HeaderTemplate>
<table width="100%" style="font: 8pt verdana">
<tr style="background-color:DFA894">
<th>
User ID
</th>
<th>
Surname
</th>
<th>
Firstname
</th>
<th>
Username
</th>
<th>
Password
</th>
<th>
Access
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:FFECD8">
<td>
<%# DataBinder.Eval(Container.DataItem, "ID") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "surname")
%>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem,
"firstname") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem,
"username") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem,
"password") %>
</td>
<td>
>>>>> Problem code
<asp:DropDownList id="dList1" width=100 runat="server">
<option
value=<%#DataBinder.Eval(Container.DataItem, "account_live")%>>
<%# DataBinder.Eval(Container.DataItem, "account_live") %>
</option>
>>>> Problem code ends
</asp:DropDownList>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</ASP:Repeater>
</form>
</body>
</html
Any pointers?Your post went unanswered. Have you resolved this issue?
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"John sorCrer" <info@.emap.co.za> wrote in message
news:d70138e4.0403021226.36b59c74@.posting.google.c om...
> Hi Guru's,
> I am new to asp.net!
> I can create a repeater control but would like to add a select list to
> it as follows:
> <%@. Page Language="vb" debug=true %>
> <%@. import Namespace="System.Data" %>
> <%@. import Namespace="System.Data.SqlClient" %>
> <script runat="server">
> Sub Page_Load(sender As Object, e As EventArgs)
> Dim myConnection As SqlConnection
> Dim myCommand As SqlDataAdapter
> myConnection = New SqlConnection("server=local;user
> id=whocares;database=dbSeekersClientApp;Trusted_Co nnection=false")
> myCommand = New SqlDataAdapter("SELECT ID, username, password,
> firstname, surname, account_live FROM t_managers", myConnection)
> Dim ds As Dataset = new DataSet()
> myCommand.Fill(ds)
> MyRepeater.DataSource = ds
> MyRepeater.DataBind()
> End SUb
> </script>
> <html>
> <head>
> </head>
> <body>
> <form action="intro1.aspx" method="post" runat="server">
> <ASP:Repeater id="MyRepeater" runat="server">
> <HeaderTemplate>
> <table width="100%" style="font: 8pt verdana">
> <tr style="background-color:DFA894">
> <th>
> User ID
> </th>
> <th>
> Surname
> </th>
> <th>
> Firstname
> </th>
> <th>
> Username
> </th>
> <th>
> Password
> </th>
> <th>
> Access
> </th>
> </tr>
> </HeaderTemplate>
> <ItemTemplate>
> <tr style="background-color:FFECD8">
> <td>
> <%# DataBinder.Eval(Container.DataItem, "ID") %>
> </td>
> <td>
> <%# DataBinder.Eval(Container.DataItem, "surname")
> %>
> </td>
> <td>
> <%# DataBinder.Eval(Container.DataItem,
> "firstname") %>
> </td>
> <td>
> <%# DataBinder.Eval(Container.DataItem,
> "username") %>
> </td>
> <td>
> <%# DataBinder.Eval(Container.DataItem,
> "password") %>
> </td>
> <td>
> >>>>> Problem code
> <asp:DropDownList id="dList1" width=100 runat="server">
> <option
> value=<%#DataBinder.Eval(Container.DataItem, "account_live")%>>
> <%# DataBinder.Eval(Container.DataItem, "account_live") %>
> </option>
> >>>> Problem code ends
> </asp:DropDownList>
> </td>
> </tr>
> </ItemTemplate>
> <FooterTemplate>
> </table>
> </FooterTemplate>
> </ASP:Repeater>
> </form>
> </body>
> </html>
>
> Any pointers?
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment