i am having some trouble with repeaters each. i am trying to repeat a list of appliances under a unique categories from my database. the category names repeat allright but the appliance names repeat for all the categories(meaning all categories have the same appliances) i used a nested repeater for the appliances i do not know if that is the problem.
<%# Page Title="" Language="VB" MasterPageFile="~/public.master" AutoEventWireup="false" CodeFile="ccalc.aspx.vb" Inherits="ccalc" %>
<%# Import Namespace="System.Data" %>
<%# Import Namespace="System.Data.OleDb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<div>
<h1>Estimated Monthly Electricity Consumption Calculator</h1>
</div>
<div>
<asp:Repeater ID="myRepeater" runat="server">
<ItemTemplate>
<table width="100%" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF" class="ten">
<tbody>
<tr>
<td colspan="5"><h2>
<asp:Label ID="catid" runat="server" Text='<%#Eval("CategoryID") %>'></asp:Label>
<asp:Label ID="Catname" runat="server" Text='<%#Eval ("CategoryName") %>'></asp:Label></h2>
</td>
</tr>
<tr align="center">
<th class="style1" bgcolor="#FFCC66">Electrically Powered Items</th>
<th class="ten" bgcolor="#FFCC66"><div align="center">Quantity</div></th>
<th class="ten" bgcolor="#FFCC66"><div align="center">Average
monthly KWh</div></th>
<th class="ten" bgcolor="#FFCC66"><div align="center">KWh/month</div></th>
<th class="ten" bgcolor="#FFCC66"><div align="center">GHc /month</div></th>
</tr>
<asp:Repeater ID="innerRepeater" runat="server" DataSource = <%# sqldatasource3%> >
<ItemTemplate >
<tr>
<td class="style1"><strong>
<asp:Label ID="appName" runat="server" Text='<%#Eval ("ApplianceName") %>'></asp:Label></strong></td>
<td class="highlight"><div align="center">
<asp:TextBox ID="quantity" runat="server" AutoPostBack="True" CssClass="input"
Width="79px" ></asp:TextBox>
</div></td>
<td><div align="center">
<input name="refrigeratorMonthKWh" value="182" type="hidden" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div></td>
<td><div align="center">
<asp:TextBox ID="kwh" runat="server" CssClass="input4" Width="59px"></asp:TextBox>
</div></td>
<td><div align="center">
<asp:TextBox ID="ghc" runat="server" CssClass="input4" Width="59px"></asp:TextBox>
</div></td>
</tr>
</ItemTemplate>
</asp:Repeater>
<%
'End While
'brb.Dispose()
'br.Close()
%>
</tbody>
</table>
</ItemTemplate>
</asp:Repeater>
<%
'End While
'cmd.Dispose()
'dr.Close()
%>
</div>
<%
%>
<div>
<table width="100%" border="0" cellpadding="5" bgcolor="#FFF7E5" class="ten">
<tbody>
<tr>
<td><font color="#9f7f40">Estimated</font> monthly <u><font color="#FF0000">household </font></u>*
usage:
<asp:TextBox ID="totalusage" runat="server" CssClass="input4" Width="59px"></asp:TextBox>
kWh; <br /></td>
</tr>
<tr>
<td class="highlight"><font color="#9f7f40">Estimated</font> monthly <u><font color="#FF0000">household</font></u>*
bill: ยข
<asp:TextBox ID="totalbill" runat="server"
CssClass="input4" Width="59px"></asp:TextBox>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
SelectCommand="SELECT * FROM [DeviceCategory]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
SelectCommand="SELECT * FROM [Appliances] where ([CategoryID]=[CategoryID])">
<%--<SelectParameters>
<asp:ControlParameter ControlID=myRepeater.innerrepeater.catid Name="catid" PropertyName="Text"
Type="String" />
</SelectParameters>--%>
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td class="highlight"><h3><strong><em>*Heating usage
not included in household totals</em></strong></h3></td>
</tr>
</tbody>
</table>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
The SQL data source
<asp:SqlDataSource ID="SqlDataSource2"
Should be outside of repeater.
Related
<%# Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="Feedback.aspx.cs" Inherits="Feedbackajax" Title="Star Bus: Feedback" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content1" runat="Server">
<div id="innertitle">
<table align="center" style="margin-bottom:25px">
<tr align="left">
<td align="left">
<strong>
<asp:Label ID="lblheat" runat="server" Text="Feedback" Font-Size="X-Large" ForeColor="#F7990D"></asp:Label>
</strong>
<br />
</td>
</tr>
</table>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
<div id="rightContent">
<div class="mainText" id="maintextBox">
<!-- Body Content Starts -->
<div id="formBody" style="margin:0 auto;text-align:center">
<table cellspacing="3" cellpadding="0" border="0" align="center" style="text-align:left">
<tbody>
<tr>
<td height="30">
<strong><span>Name: </span></strong>
</td>
<td valign="middle">
<asp:TextBox ID="txtname" runat="server" />
<asp:RequiredFieldValidator ID="rfvnaem" ErrorMessage="*" ControlToValidate="txtname"
runat="server" />
</td>
</tr>
<tr>
<td height="30">
<strong><span>Email:</span></strong>
</td>
<td valign="middle">
<asp:TextBox ID="txtemail" runat="server" />
<asp:RequiredFieldValidator ID="rfvemail" ErrorMessage="*" ControlToValidate="txtemail"
runat="server" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Enter the Vaild Email ID"
ControlToValidate="txtemail" ValidationExpression="\w+([-+.']\w+)*\w+([-.]\w+)*\.\w+([-.]\w+)*" />
</td>
</tr>
<tr>
<td height="30">
<strong><span>Phone:</span></strong>
</td>
<td valign="middle">
<asp:TextBox ID="txtph" runat="server" />
<asp:RangeValidator ID="rangeph" ControlToValidate="txtph" Text="Invalid Phone" Type="Double"
MinimumValue="1" MaximumValue="9999999999" runat="server" />
</td>
</tr>
<tr>
<td height="30">
<strong><span>Subject:</span></strong>
</td>
<td valign="middle">
<div id="txtHint">
<asp:DropDownList CssClass="form" tyle="width: 130px" ID="dlsubject" runat="server"
Width="133px">
<asp:ListItem Text="Bus service" Value="Bus service"></asp:ListItem>
<asp:ListItem Text="website" Value="website"></asp:ListItem>
<asp:ListItem Text="schedules" Value="schedules"></asp:ListItem>
<asp:ListItem Text="Other" Value="Other"></asp:ListItem>
</asp:DropDownList>
</div>
</td>
</tr>
<tr>
<td>
<strong><span style="vertical-align:middle">Comment:</span></strong><br />(Max 1000 char)
</td>
<td class="style1">
<asp:TextBox ID="txtcomment" runat="server" MaxLength="1000" TextMode="MultiLine"
Height="75px" Width="235px" />
<asp:RequiredFieldValidator ID="rfvcomment" ErrorMessage="*" ControlToValidate="txtcomment"
runat="server" />
</td>
</tr>
<tr>
<td> </td>
<td colspan="2">
<asp:Button ID="btnsubmit" runat="server" Text="Submit" OnClick="btnsubmit_Click" />
</td>
</tr>
</tbody>
</table>
</div>
<!-- Body Content Ends -->
</div>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder3" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="ContentPlaceHolder4" runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
</asp:Content>
This is my ASP.NET project that I have already created. But now I have the need to convert this project to ASP.NET Core 2.1 or later.
I am finding it difficult to do it as there is a lot that has changed.
I would like to get the assistance of the expertise on how I could do it please.
My greatest problem is not knowing how to replace certain place holders and tag helpers to the newer version.
Regards
After fill all the fields , submit button doesn't work and cancel also do nothing.
This function in my _.aspx.cs code:
protected void cancel_Click1(object sender, EventArgs e)
{
Response.Redirect("Home.aspx");}
and this is my aspx code
<%# Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="DonorSignUp.aspx.cs"> Inherits="BloodBank.DonorSignUp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">
Donor Sign Up Page
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="contentBody" runat="server">
<
<h1> DONOR REGISTRATION<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnStr %>" SelectCommand="SELECT * FROM [donor_table]"></asp:SqlDataSource>
</h1>
<table>
<tr>
<td> First Name </td>
<td> <asp:TextBox ID="name" runat="server" Width="139px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="name" ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Last Name</td>
<td> <asp:TextBox ID="last" runat="server" Width="140px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="last" ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
<td>Username</td>
<td><asp:TextBox ID="username" runat="server" Width="176px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="username" ErrorMessage="Please enter the usename"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Password</td>
<td><asp:TextBox ID="password" runat="server" Width="170px" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="password" ErrorMessage="password"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Confirm</td>
<td> <asp:TextBox ID="confirm" runat="server" Width="155px" TextMode="Password"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="password" ControlToValidate="confirm" ErrorMessage="password doesn't match"></asp:CompareValidator>
</td>
</tr>
<tr>
<td colspan="2"><asp:Label ID="msgDSignUp" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="Label2" runat="server" Text="Fill all the blanks"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="SignUpDonor" runat="server" Text="Submit" BackColor="#ff99cc" BorderColor="#ff99cc" OnClick="SignUpDonor_Click1" />
</td>
<td>
<asp:Button ID="cancel" runat="server" Text="Cancel" OnClick="cancel_Click1"/>
</td>
</tr>
</table>
</asp:Content>
When I press cancel button , it does nothing unless I fill all the field in the page ,, if I filled them and press cancel it does the code inside cancel_Click
Can you help me to manipulate this?
This is correct behavior. If you want to test it by going straight to the Cancel event handler, then just comment out all the validators or disable client-side validation temporarily using CausesValidation="false". Validation can occur on both client and server - always best to use both.
Check out this question.
I am trying to implement a bootstrap's crousal and navbar using asp.net's master page
but nothing is apearing in the pages i tried to implement master page
Master page code
<%# Master Language="C#" AutoEventWireup="true"
CodeBehind="Survey.master.cs" Inherits="SurveySystem.Survey" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="body" runat="server">
<asp:Image ID="Image1" runat="server"
src="~/ProjectImage/download (2).jpg"/>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
Form on which i tried to implement master page
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="SignUp.aspx.cs"
Inherits="SurveySystem.SignUp" MasterPageFile="~/Survey.Master" %>
<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="body" >
<h3 align="center">
Sign Up to Create Your Survey
</h3>
<table >
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label1" runat="server" Text="First
Name*">
</asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="TextBoxFirstName" runat="server"
placeholder="First Name" class="form-control"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label2" runat="server" Text="Middle
Name"></asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox class="form-control" ID="TextBoxMiddleName"
runat="server" placeholder="Middle Name"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label3" runat="server" Text="Last Name">
</asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="TextBoxLastName" class="form-control"
runat="server" placeholder="Last Name"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label5" runat="server" Text="Email*">
</asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="TextBoxEmail" runat="server"
class="form-control" placeholder="Email"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label4" runat="server" Text="Password*">
</asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="TextBoxpassword" runat="server"
class="form-control" TextMode="Password" placeholder="Password">
</asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label6" runat="server" Text="Confirm
Password*"></asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="TextBoxConfirm" TextMode="Password"
runat="server" class="form-control" placeholder="Confirm Password">
</asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:FileUpload ID="UserFileUploadImage" runat="server"
/>
</td>
<td class="auto-style2">
<asp:Image ID="UserImagUpload" class="img-rounded"
runat="server" Width="150px" Height="150px" />
</td>
</tr>
<tr>
<td colspan="3" align="center">
<asp:Button ID="ButtonSignUp" runat="server"
Text="SignUp" OnClick="ButtonSignUp_Click" />
</td>
</tr>
<tr>
<td colspan="2">
* Mendatory Fields (You Must Fill these Fields)
</td>
</tr>
</table>
</asp:Content>
Here is the all code i am implementing but it isnt showing me any thing of Bootstrap crousal and navbar
You have placed image inside the asp ContentPlaceHolder which is wrong.
As the name suggest It is just a place holder and anything you want to put inside it must be put in the WebForms Content tags.
Your code should look like this:
Master
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Survey.master.cs" Inherits="SurveySystem.Survey" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Image ID="Image1" runat="server" src="~/ProjectImage/download (2).jpg" />
<asp:ContentPlaceHolder ID="body" runat="server">
<%-- Dont write any code here --%>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
WebForms
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="SignUp.aspx.cs" Inherits="SurveySystem.SignUp" MasterPageFile="~/Survey.Master" %>
<asp:Content runat="server" ID="Content2" ContentPlaceHolderID="head"></asp:Content>
<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="body">
<h3 align="center">Sign Up to Create Your Survey
</h3>
<table>
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label1" runat="server" Text="First Name*"></asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="TextBoxFirstName" runat="server" placeholder="First Name" class="form-control"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label2" runat="server" Text="Middle Name"></asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox class="form-control" ID="TextBoxMiddleName" runat="server" placeholder="Middle Name"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label3" runat="server" Text="Last Name"></asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="TextBoxLastName" class="form-control" runat="server" placeholder="Last Name"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label5" runat="server" Text="Email*"></asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="TextBoxEmail" runat="server" class="form-control" placeholder="Email"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label4" runat="server" Text="Password*"></asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="TextBoxpassword" runat="server" class="form-control" TextMode="Password" placeholder="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style1" colspan="2">
<asp:Label ID="Label6" runat="server" Text="Confirm Password*"></asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="TextBoxConfirm" TextMode="Password" runat="server" class="form-control" placeholder="Confirm Password"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:FileUpload ID="UserFileUploadImage" runat="server" />
</td>
<td class="auto-style2">
<asp:Image ID="UserImagUpload" class="img-rounded" runat="server" Width="150px" Height="150px" />
</td>
</tr>
<tr>
<td colspan="3" align="center">
<asp:Button ID="ButtonSignUp" runat="server" Text="SignUp" OnClick="ButtonSignUp_Click" />
</td>
</tr>
<tr>
<td colspan="2">* Mendatory Fields (You Must Fill these Fields)
</td>
</tr>
</table>
</asp:Content>
Master :
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPageName.master.cs" Inherits="ApplicationName.MasterPageName" %>
....
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form runat="server">
<div class="row">
<div class="col-md-12">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</div>
<!-- END PAGE CONTENT-->
</div>
</form>
</body>
Pages :
<%# Page Title="" Language="C#" MasterPageFile="~/MasterPageName.Master" AutoEventWireup="true" CodeBehind="PageName.aspx.cs" Inherits="ApplicationName.FolderExistsIFHave.PageName" culture="auto" meta:resourcekey="PageResource1" uiculture="auto" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>Blank Page</h1>
</asp:Content>
I have created a listview based on the below data:
<div class="showJournals">
<asp:ListView ID="ListJournal" runat="server" DataSourceID="journalData" >
<EmptyDataTemplate>
<table runat="server" style="">
<tr>
<td>Finner ingen journaler.</td>
</tr>
</table>
</EmptyDataTemplate>
<ItemTemplate>
<tr style="">
<td class="navn">
<%# Eval("journalSentBy") %>
<%# Eval("journalrecvdBy") %>
</td>
<td class="text">
<asp:Label ID="journalTextLabel" runat="server" Text='<%# Eval("journalText") %>' />
</td>
<td>
<asp:Label ID="journalDateLabel" runat="server" Text='<%# Eval("journalDate") %>' />
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table id="itemPlaceholderContainer" runat="server" style="" cellpadding="0" cellspacing="0" border="0">
<tr runat="server" style="">
<th runat="server" class="navn">Navn</th>
<th runat="server" class="text">Journaltekst</th>
<th runat="server">Dato</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
<asp:SqlDataSource ID="journalData" runat="server" ConnectionString="<%$ ConnectionStrings:S2000ConnectionString %>" SelectCommand="SELECT [journalSentBy], [journalrecvdBy], [journalText], [journalDate] FROM [TBL_CASE_JOURNAL] WHERE ([journalCaseId] = #journalCaseId) ORDER BY [journalDate] DESC">
<SelectParameters>
<asp:ControlParameter ControlID="txtcase" Name="journalCaseId" PropertyName="Text" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</div>
My problem comes when i have created a function to insert New lines into the DB table and goes back to the listview, i cant get the list to be refreshed With the New data. Is there some commands or possible to create a function to handle this? Many thanks for any response concerning this!
At the end of your function add:
ListJournal.DataBind();
It should work.
I have grid view which contains five radio buttons per row. Out of these five only one can be checked at a time. To achieve this I tried to keep Id property of radio button corresponding to database value. But it gives me an error in Id field. .Net does not allow to use eval function in ID property. The rows will depend on number of records in database. I want to keep 5 radio button in database and out of these five, only one can be checked. How to achieve this task?
//My code of .aspx page is as below.
<%# Page Title="Applicant Rating Form" Language="C#" MasterPageFile="~/Interviewer/interviewerMasterPage.master" AutoEventWireup="true" CodeFile="AppRatingForm.aspx.cs" Inherits="Interviewer_AppRatingForm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table cellpadding="2" width="100%">
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td align="center" class="tdtitle" colspan="2">
Interview Rating Form</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td width="25%">
Name of Applicant</td>
<td>
<asp:Label ID="nameLbl" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td>
Post Applied For</td>
<td>
</td>
</tr>
<tr>
<td>
Department</td>
<td>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td align="center" class="tdtitle" colspan="2">
Assessment</td>
</tr>
<tr>
<td align="left" colspan="2">
<asp:GridView ID="assesmentGrid" runat="server" AutoGenerateColumns="False"
onpageindexchanging="assesmentGrid_PageIndexChanging">
<Columns>
<asp:BoundField HeaderText="ID" DataField="SecId"/>
<asp:BoundField HeaderText="Traits" DataField="SecName"/>
<asp:TemplateField>
<HeaderTemplate>
A
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton ID='<%# Eval("SecId") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
B
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton ID='<%# Eval("SecId") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
C
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton ID='<%# Eval("SecId") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
D
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton ID='<%# Eval("SecId") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
E
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton ID='<%# Eval("SecId") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Comments
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="commentBox" runat="server" TextMode="MultiLine"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td align="center" class="tdtitle" colspan="2">
</td>
</tr>
<tr>
<td align="center" colspan="2">
</td>
</tr>
<tr>
<td align="center" colspan="2">
</td>
</tr>
</table>
</asp:Content>
You need to set the GroupName property of all RadioButtons in the same group/row. This will only allow one to be selected at a time. I wouldn't suggest trying to set the IDs dynamically using Eval, just make sure they are all unique and it should work fine.