datagrid and radio buttons question

J

Jay

I need to validate 21 sets of radio buttons before submission to the server
for calculation and storage. Is it best to validate on the client side
using javascript or to validate on the server using the code behind
vbscript. It seems that natural to validate before submission.

If javascript is the best then how do I the variables. I noticed some
javascript that was dynamically created which looks like the following:

dgQuestions$_ctl7$_ctl0

Is this something similar to what I need to do?

Or are there alternate methods to access the variables. Below is the
datagrid control that I have defined. There are 4 radio buttons per
question in the datagrid. The radio buttons are databound as are the
questions.

Thank you so much!

<asp:datagrid ItemStyle-HorizontalAlign="Left"
ItemStyle-VerticalAlign="Middle"
BackImageUrl="images/keyboardwatermark.JPG" 1BackColor="lightsteelblue"
AlternatingItemStyle- BackColor="gainsboro"
id="dgSections"
runat="server" DataKeyField="QID" Width="90%">
<SelectedItemStyle-Font-Bold="True" ForeColor="White"
BackColor="LightCoral"></SelectedItemStyle>
<HeaderStyle Font-Size="8" Font-Bold="True" ForeColor="lightsteelblue"
BackColor="#333333"></HeaderStyle>
<FooterStyle ForeColor="Black" BackColor="#CCCC99"></FooterStyle>
<Columns>
<asp:TemplateColumn HeaderStyle-Font-Size="7"
HeaderStyle-HorizontalAlign="CENTER" HeaderText="Disagree------>Agree">
<ItemTemplate>
<asp:radiobuttonlist Font-Size="7" DataSource='<%# LoadNames() %>'
DataValueField="AID" DataTextField="" runat="server" ID="ddlAnswers"
RepeatColumns="4">
</asp:radiobuttonlist>
/ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Right" ForeColor="Black"
BackColor="White"></PagerStyle>
</asp:datagrid>
 
P

Peter Blum

You would have to write a custom validator to do this. Microsoft doesn't
supply a validator that handles RadioButtonLists (nor CheckBoxLists). This
also means that you will have to write the javascript needed for client-side
validation.

I have a commercial solution. My product, "Professional Validation And More"
(http://www.peterblum.com/vam/home.aspx) includes validators for
RadioButtonLists amongst its 22 validators.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

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

Top