473,473 Members | 4,204 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DataBinding and RadioButtonList

Hello.
I`m killing my computer for 2 days and I can`y figure it out. First I
will present the situation:
I`m building and WWW system in VS 2005. I`m using a MaterPage ( maybe
this is the problem ) and in one web form I put the ForView with edit
state enabled. In this edit temlate I`ve got RadioButtonList with two
items: Yes (value: true), No (value: false).
When I do the INSERT I want to read the value of selected item from
RadioButtonList. But anytime I do it, I always get false (when I tried
with string format it was always returning null).
When I did the same temlate without MasterPage ( without ContentPage )
it worked.
What in the hell is the problem??
Please HELP...
---------------- HTML CODE --------------------

<InsertItemTemplate>
<table class="formtable" cellspacing='0'
border='1' style="width: 579px">
<tbody>
<tr>
<td style="width: 90px; height: 2px"
align="center" >
<h4>
<asp:Label ID="LabelBasic"
runat="server" Text="Basic Info"></asp:Label></h4>
</td>
</tr>
<tr>
<td class="label" style="width: 90px;
height: 29px">
<asp:Label ID="LabelName"
runat="server" Text="Name:" ></asp:Label></td>
<td style="width: 178px; height:
29px; font-size: 7pt;" >
<asp:TextBox ID="TextBoxName"
runat="server" CssClass="inputtext" Width="261px" Text='<%#
Bind("Name") %>'></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidatorName" runat="server" ErrorMessage="Name is
required."
ControlToValidate="TextBoxName"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td class="label" style="width: 90px;
height: 29px">
<asp:Label ID="LabelCompanyName"
runat="server" Text="Assigned Comapny:" Width="112px"></asp:Label></td>
<td style="font-size: 7pt; width:
178px; height: 29px">
<table>
<tr>
<td>
<asp:CheckBox
ID="CheckBoxCompany" runat="server" Text="Yes" Checked="false" />
</td>
<td id="companyList"
runat="server" style="width: 220px" visible="true">
<asp:DropDownList
ID="DropDownListCompanyName" runat="server" Width="153px"
DataSourceID="ObjectDataCompany" DataTextField="Name"
DataValueField="IdCompany" SelectedValue='<%# Bind("IdCompany") %>'
DataSource='<%# Bind("Name") %>'>

</asp:DropDownList><asp:ObjectDataSource ID="ObjectDataCompany"
runat="server" SelectMethod="SelectCompanyIdName"

TypeName="CompanyDB.CompanyDB"></asp:ObjectDataSource>
</td>
</tr>
</table>
</td>
</tr>
<tr id="companyAdmin" runat="server">
<td class="label c4" style="width:
90px; height: 25px;">
<asp:Label ID="LabelCompanyAdmin"
runat="server" Text="Company Admin:" Width="103px"></asp:Label></td>
<td class="c4" style="font-size: 7pt;
color: #666666; width: 178px; height: 25px;">
&nbsp;<asp:RadioButtonList
ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
SelectedValue='<%# Bind ("CompanyAdmin") %>'>
<asp:ListItem
Value="true">Yes</asp:ListItem>
<asp:ListItem
Value="false">False</asp:ListItem>
</asp:RadioButtonList></td>
</tr>
<tr>
<td class="label c4" style="width:
90px">
<asp:Label ID="LabelComments"
runat="server" Text="Comments:" Width="103px"></asp:Label></td>
<td class="c4" style="font-size: 7pt;
width: 178px; color: #666666">
<asp:TextBox ID="TextBoxComments"
runat="server" CssClass="inputtext" TextMode="MultiLine" Width="146px"
Text='<%# Bind("Comments") %>'></asp:TextBox></td>
</tr>
</tbody>
</table>
<br />
<br />
&nbsp;<asp:Button ID="ButtonCreate"
runat="server" CommandName="Insert" Text="Create"
CssClass="inputsubmit" Height="19px" Width="61px" />&nbsp;
</InsertItemTemplate>

Jul 26 '06 #1
0 3171

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nidhi Mittal | last post by:
HI, I'm trying to have one options for the radiobutton list to be selected based on the value stored in the database. But I do not know how to do that. here's my code in the aspx page: ...
6
by: Hazzard | last post by:
I store radiobuttonlist values in the db using the string value of the radio button item value. (nvarchar) I am creating an edit functionality on the asp.net form so that when I reuse my...
0
by: Arun K | last post by:
Hi, I have a RadioButtonList with Active and Inactive List Items (static) with other textbox fields. When the form is in edit mode i need to get data from database and show the status checked...
5
by: DotNetGruven | last post by:
Anyone have any pointers on how to set the Value and Selected attributes in a ListItem in a RadioButtonList that is in a DataGrid? Here's what I have ------DataGrid------ -- BoundColumn 0 --...
6
by: DotNetGruven | last post by:
I have a webform that has a DataGrid on it with a RadioButtonList in each row. It is a simple On & Off. When the User Clicks on either of the RadioButtons, I need to postback to the server and...
4
by: Emil | last post by:
Can somebody tell me what would be the syntax for having an if statement and setting the selected index of a radiobuttonlist? This is my first project using ASP.net and I use C#. I have a repeater...
0
by: CDARS | last post by:
Dear all, I understand that I can bind a DataSet to a RadioButtonList control with properties DataTextField and DataValueField. ASP.NET will have the ListItem objects generated. Nice. Well...
2
by: Wayne Wengert | last post by:
I have a VSNET 2003 ASPX page which contains a RadioButtonList Control that I want to populate from an existing column in an existing table. I've done this in the past using a datareader and...
0
by: Nevyn Twyll | last post by:
I have a set of radiobuttons that I want to put as an element in a Datalist. But I need the radiobuttons to have a very particular look, so I can't use the RadioButtonList class. So, I made a user...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.