DataBinding and RadioButtonList

M

marianowic

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top