By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,870 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,870 IT Pros & Developers. It's quick & easy.

datagrid and radio buttons question

P: n/a
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>
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Jay" <ja**********@hotmail.com> wrote in message
news:Uk%Rb.3226$EW.3080@okepread02...
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>

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.