-
checkboxlist inside a formview databind with objectdatasource
Hi,
Somebody please tell me how to bind(two way) a checkboxlist with
objectdatasource if the checkboxlist is inside a formview.....
Code of FormView is like this::---
<asp:FormView ID="FormView1" runat="server"
DataSourceID="ObjectDataSource1">
<EditItemTemplate>
<table border="0" cellpadding="0" cellspacing="0"
style="width: 100%">
<tr>
<td align="left" style="width:
100px; height: 16px;">
<asp:Label ID="lblUserName"
runat="server" AssociatedControlID="lblEditUserName" Text="User Name:"
Width="100px"></asp:Label></td>
<td align="left" style="width:
100px; height: 16px;">
<asp:Label
ID="lblEditUserName" runat="server" Text='<%# Eval("UserName")
%>'></asp:Label></td>
<td align="left" style="width:
100px; height: 16px;">
</td>
</tr>
<tr>
<td align="left" style="width:
100px">
<asp:Label
ID="lblFirstName" runat="server" AssociatedControlID="FirstName"
Text="First Name:"
Width="57px"></asp:Label></td>
<td align="left" style="width:
98px">
<asp:TextBox ID="FirstName"
runat="server" Text='<%# Bind("FirstName") %>'
CssClass="textbox"></asp:TextBox></td>
<td align="left" style="width:
100px">
</td>
</tr>
<tr>
<td align="left" style="width:
100px">
<asp:Label ID="lblLastName"
runat="server" AssociatedControlID="LastName" Text="Last Name:"
Width="57px"></asp:Label></td>
<td align="left" style="width:
98px">
<asp:TextBox ID="LastName"
runat="server" Text='<%# Bind("LastName") %>'
CssClass="textbox"></asp:TextBox></td>
<td align="left" style="width:
100px">
</td>
</tr>
<tr>
<td align="left" style="width:
100px">
<asp:Label ID="lblEmail"
runat="server" AssociatedControlID="Email" Text="Email:"
Width="57px"></asp:Label></td>
<td align="left" style="width:
98px">
<asp:TextBox ID="Email"
runat="server" Text='<%# Bind("Email") %>'
CssClass="textbox"></asp:TextBox>
<asp:RequiredFieldValidator
ID="EmailRequired" runat="server" ControlToValidate="Email"
Display="Dynamic" ErrorMessage="Email
is a required field."
ValidationGroup="modifyProfile">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator
ID="EmailFormat" runat="server" ControlToValidate="Email"
Display="Dynamic" ErrorMessage="The
email format is invalid." ValidationExpression="\S+@\S+\.\S+"
ValidationGroup="modifyProfile">*</asp:RegularExpressionValidator></td>
<td align="left" style="width:
100px">
</td>
</tr>
<tr>
<td align="left" style="width: 100px">
<asp:Label ID="lblEditOccupation"
runat="server" AssociatedControlID="cbEditOccupation"
Text="Occupation"></asp:Label></td>
<td align="left" style="width: 98px">
<asp:CheckBoxList ID="cbEditOccupation"
runat="server" AppendDataBoundItems="true" DataTextField='<%#
Bind("Occupation") %>'
DataValueField='<%#
Bind("Occupation") %>' RepeatColumns="2" RepeatDirection="Horizontal">
<asp:ListItem>Shopkeeper</asp:ListItem>
<asp:ListItem>Publisher</asp:ListItem>
<asp:ListItem>Teacher</asp:ListItem>
<asp:ListItem>Scientist</asp:ListItem>
</asp:CheckBoxList></td>
<td align="left" style="width: 100px">
</td>
</tr>
</table>
</EditItemTemplate>
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0"
style="width: 100%">
<tr>
<td align="left"
style="width: 100px; height: 16px;">
<asp:Label
ID="lblUserName" runat="server" AssociatedControlID="UserNameLabel"
Text="User Name:"
Width="100px"></asp:Label></td>
<td align="left"
style="width: 100px; height: 16px;">
<asp:Label
ID="UserNameLabel" runat="server" Text='<%# Bind("UserName")
%>'></asp:Label></td>
<td align="left"
style="width: 100px; height: 16px;">
</td>
</tr>
<tr>
<td align="left"
style="width: 100px">
<asp:Label
ID="lblFirstName" runat="server" AssociatedControlID="FirstNameLabel"
Text="First Name:"
Width="57px"></asp:Label></td>
<td align="left"
style="width: 100px">
<asp:Label
ID="FirstNameLabel" runat="server" Text='<%# Bind("FirstName")
%>'></asp:Label></td>
<td align="left"
style="width: 100px">
</td>
</tr>
<tr>
<td align="left"
style="width: 100px">
<asp:Label
ID="lblLastName" runat="server" AssociatedControlID="LastNameLabel"
Text="Last Name:"
Width="57px"></asp:Label></td>
<td align="left"
style="width: 100px">
<asp:Label
ID="LastNameLabel" runat="server" Text='<%# Bind("LastName")
%>'></asp:Label></td>
<td align="left"
style="width: 100px">
</td>
</tr>
<tr>
<td align="left"
style="width: 100px">
<asp:Label
ID="lblEmail" runat="server" AssociatedControlID="EmailLabel"
Text="Email:"
Width="57px"></asp:Label></td>
<td align="left"
style="width: 100px">
<asp:Label
ID="EmailLabel" runat="server" Text='<%# Bind("Email")
%>'></asp:Label></td>
<td align="left"
style="width: 100px">
</td>
</tr>
<tr>
<td align="left" style="width: 100px">
<asp:Label ID="lblOccupation"
runat="server" AssociatedControlID="cbOccupation"
Text="Occupation"></asp:Label></td>
<td align="left" style="width: 100px">
<asp:CheckBoxList ID="cbOccupation"
runat="server" DataSourceID="ObjectDataSource1"
AppendDataBoundItems="true" DataTextField='<%# Bind("Occupation") %>'
DataValueField='<%# Bind("Occupation") %>'
RepeatColumns="2"
RepeatDirection="Horizontal" Enabled="false">
<asp:ListItem>Shopkeeper</asp:ListItem>
<asp:ListItem>Publisher</asp:ListItem>
<asp:ListItem>Teacher</asp:ListItem>
<asp:ListItem>Scientist</asp:ListItem>
</asp:CheckBoxList></td>
<td align="left" style="width: 100px">
</td>
</tr>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetUser"
TypeName="Membership.MembershipManager"
UpdateMethod="EditUser">
<UpdateParameters>
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="Occupation" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ProfileParameter Name="UserName"
PropertyName="UserName" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
Please help me how can i show this checkboxlist value from the profile
table and also update or insert in the profile through
checkboxlist(checkboxlist is inside a formview)
Please...Please help me....
Thanks in advance.....
Similar Threads
-
By sugumar in forum ASP.NET
Replies: 9
Last Post: 02-13-2008, 04:27 PM
-
By gabru123 in forum ASP.NET
Replies: 0
Last Post: 07-19-2006, 03:10 PM
-
By drkybelk in forum ASP.NET
Replies: 0
Last Post: 01-23-2006, 09:05 AM
-
By drkybelk in forum .NET
Replies: 0
Last Post: 01-19-2006, 05:02 AM
-
By maria in forum VB Classic
Replies: 0
Last Post: 05-01-2001, 06:37 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks