?
Solved

Microsoft, Asp.Net, 2.0 - asp:FormView | EditItemTemplate |  asp:radiobuttonlist

Posted on 2008-10-15
2
Medium Priority
?
327 Views
Last Modified: 2013-11-07
Dear Experts,
I have using an asp:FormView to capture data from end users.  Within this form I want the user to be able to edit a response if a mistake is made using 3 different asp:ListItems.  My problem is that when the user clicks on the form's edit button the edit portion of the asp:FormView does not capture the result that has already been stored in SQL Server.  So to the user, it looks like nothing was ever chosen.

How can I get the asp:RadioButtonList  to properly display the "selected" option that is stored in the database?  I'm new at codebehind and VB Scripting, so any example would be greatly appreciated.  I've read a lot about databinding options, but I don;t seem to grasp how to properly do it.

I am using a stored procedure to select all the necessary fields for the form.  This particular asp:RadioButtonList will be used for 15 different questions, each using the same 3 response options.  I should also mention that the field in the database is storing String values and not Boleen values.

Here's my code snippet:

<asp:Content>
<asp:FormView>
<EditItemTemplate>

<tr><td>
<asp:RadioButtonList ID="Sect1Fld1Opt1" runat="server" RepeatDirection="Horizontal">
         <asp:ListItem Text="N/A" Value="N/A" />
         <asp:ListItem Text="Complies" Value="Complies" />
         <asp:ListItem Text="Repairs Needed" Value="Repairs Needed" />
      </asp:RadioButtonList>
</td></tr>

</EditItemTemplate>
</asp:FormView>
</asp:Content>
0
Comment
Question by:Beallcorp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
crazyman earned 2000 total points
ID: 22722517
Try adding this to the RadioButtonList

SelectedValue = '<%# Eval("YourFieldWithSelectedValueIn")%>'
0
 

Author Comment

by:Beallcorp
ID: 22722608
Excellent!  Thank you crazyman! I can't tell you how long I've been staring at this bugger.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question