.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links
" yc=""><tr>
"><td> <strong> Gender: </ strong> </ td>

RadioButtonList in FormView EditTemplate's not me behind and OldValue NewValues

Posted By:      Posted Date: August 25, 2010    Points: 0   Category :ASP.Net

Hello people,

I am using FormView component which has a field that is the sex of the person that I am using RadioButtonList with a simple way to show Male and Female, but want to retrieve the information and OldValue NewValues not anything behind me.

In the FormView Edit Template:
" yc=""><! - SEX ->

Gender: " yc="Sexo:   " yc=""><td>
   'RepeatColumns = "2">     " yc="' RepeatColumns="2">"><Asp: RadioButtonList ID = "CHR_SEXORadioButtonList" runat = "server" SelectedValue ='<%# Eval ("CHR_SEXO")%> &#

View Complete Post

More Related Resource Links

FormView control having radiobuttonList as child control which is bound to another datasource

Hi all, Mine is an Online Exam application. I am thinking to place the questions and answer options inside a formview control. As options are from different table ,so I wanted to use RadioButtonList as child control of FormViewControl to display options which is bound to another datasource .How can I do this please help.  

Selected value of RadioButtonList inside a formview get cleared on button click.

Hi all,I placed a RadioButtonList inside a Formview control.And from  DataBound event handler of formview ,RadioButtonList is binded to the datasource .Now my problem is after selecting a value from radiobuttonlist and I click any button,the radiobuttonList get unchecked and lose the selected value .How can I avoid this.Please help..

Help with checkboxlist in formview edittemplate data display



I can insert a checkboxlist selected value as comma delimited string into the database. But I have hard time to reload it in formview edit mode.  I added a hidden label to retrieve the comma delimited string and try to use checkboxlist databound event, but it doesn't work. I don't know what problem is in my code. Please help me:

protected string sessiontypestr = string.Empty;

protected void chkType_DataBound(object sender, EventArgs e)
            CheckBoxList c = (CheckBoxList)FormView1.FindControl("chkType");
            if (c != null)

                Label test = (Label)(FormView1.FindControl("lblhiddensessiontype"));
                sessiontypestr = test.Text;

                string[] items = sessiontypestr.Split(',');

                for (int i = 0; i < c.Items.Count; i++)
                    if (items.Contains(c.Items[i].Value))
                        c.Items[i].Selected = true;


<asp:CheckBoxList ID="chkType" runat="server" Font-Size="Smaller" 
                SelectedValue='<%# Bind("session_type") %>' 

Formview LinqData source not allowing updates


OK, I'm confused.  I've set up a formview with a Linqdata source to allow users to edit records.  When I run it, edit data and submit, it blows up and tells me "Linq datasource6  does not support the Select property when the Delete, Insert or Update operations are enabled."  I googled that warning and saw a couple of posts on this forum saying the problem is the slect statement has to be removed from the Linq data source for it to allow updates. 

But if I remove the select statement then how do I show the user specific info on pageload?   plus I thought the two way databind was an advantge of the datasource control.




FormView -- Parameters and asp:Table


I've already solved this problem to my satisfaction, I just want to know WHY it works this way.

I have a FormView control bound to an ObjectDataSource.  Let's say our data source is a hypothetical table with three columns:  id, name, age.  Why is it that when I use the <asp:Table> element inside of the FormView, the parameter values are not set, but when I use the standard <table> tag, it works fine?

This seems like a .NET problem to me.  I expect the <asp:Table> element to work in the same way as <table> because they are, for all intents and purposes, the same thing.  Am I missing something?

DropDownList within FormView Error

I have a FormView which works find and I have added a new DropDownList within the form which references another table to which I need to select a value,
I have added the dropdownlist2 and setup a new connection string to this, when I run the page I get this error:

Could not find control 'DropDownList2' in ControlParameter 'CurrencyID'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Could not find control 'DropDownList2' in ControlParameter 'CurrencyID'.
any help would be greatly

Table format of RadioButtonList


Hi All,

I have radiobuttonlist with 3 listItem, i need to give the table format to radiobuttonlist means it looks like table with row, how can i give, Any idea?

My code:-

<asp:RadioButtonList ID="RbAccount" runat="server" cssClass="Request">
<asp:ListItem Value="update" Selected="True">Change existing account </asp:ListItem>
<asp:ListItem Value="deprovision">Remove an account </asp:ListItem>
<asp:ListItem Value="new" Enabled="false">Create a new account </asp:ListItem>

If i am using this css style, it is giving me border all all the tables i have on page, i just want only this radiobuttonlist, Any idea ?

<style type="text/css">
    border:1px solid black;

Need Help with Radiobuttonlist Style ASAP


How could is style the button or sort of icon into the gif image i wan

Example here is the CSS code
.radio {
width: 19px;
height: 25px;
padding: 0 5px 0 0;
background: url(checkbox.gif) no-repeat;
display: block;
clear: left;
float: left;

.radio {
background: url(radio.gif) no-repeat;

.select {
position: absolute;
width: 158px;
height: 21px;
padding: 0 24px 0 8px;
color: #fff;
font: 12px/21px arial,sans-serif;
background: url(select.gif) no-repeat;
overflow: hidden;

How could i call it in ASP to be used in
<asp:RadioButtonList ID="RadioButtonList3" style="position: relative" 
runat="server" AutoPostBack="true" 
OnSelectedIndexChanged="RadioButtonList3_SelectedIndexChanged" Height="26px" 
Width="208px" " BorderStyle="None" 

Help ~~ How to Update Binary Image on Formview

Hi All ~~ I'm confused, Can i have some help please... Thanks
Database: Books
uid dataType uniqueidentifier
Cover dataType image 
aspx :
 <asp:FormView ID="FormView1" runat="server" BackColor="LightGoldenrodYellow"   BorderColor="Tan" BorderWidth="1px" CellPadding="2" DataKeyNames="uid"     DataSourceID="SqlDataSource1" ForeColor="Black" Width="525px">
         <table class="table_width">
                 <td class="imageWidth">
                     <asp:Image ID="Image1" runat="server" Height="245px" 
                                       ImageUrl='<%# IIF(Eval("Cover") Is DbNull.Value, "~/Styles/Global/CFZ-No-Images.png", Eval("uid", "~/ImageServices.ashx?BooksID={0}")) %>' Width="180px" />

Help with displaying formview based on dropdownlist


I have a formview1 with a dropdownlist1 in the insert template. Based on the value of that dropdownlist I would like to display a second formview on the same page in insert mode so that I can write data to two different tables.

How can I accomplish this?

Is this the best way to do it?



FormView KeepInEditMode=true isn't retaining values


I have an "Edit Page" in my application. It uses a FormView bound to an EntityDataSource.

I have a handler setup for the FormView OnItemUpdated event. If an exception occurs (such as foreign key constraints or non date vales entered in a date colum, etc.), then I set the "KeepInEditMode=true". This is SUPPOSED to retain the user entered values on all of the text boxes instead of rebinding the FormView to the data again and clearing those text boxes. (Right?)

Well, it isn't working...

I have stepped through the code via the debugger and the "KeepInEditMode" does get set to true, but as soon as the page reloads, the values revert back to the original database values (the data is being rebound).

I should also mention that I am setting "ExceptionHandled" to true. I am doing this because I am handling the Exception by displaying an error in a specific area of the page and if I dont mark it as handled, IE generates an Exception popup.

Any ideas?

FormView Text Field Being Set by A Drop Down List


Hello, I have a FormView which is used to insert a record into a database.  Outside of this formview i have a drop down list, I want to grab the value from that drop down list and set one of the text fields within the formview to it's currently selected value.  I've tried the following code, but the dynamic categorytextbox line is what seems to not be working.

                    <asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="True" 
DataSourceID="SqlDataSourceCategory" DataTextField="CategoryName"
DataValueField="CategoryID" Width="200px">

                            <asp:TextBox ID="CategoryIDTextBox" runat="server" 
Text='<%# Bind("CategoryID") %>' Visible="False" />

        protected void FormView1_DataBound(object sender, EventArgs e)
dynamic varCategory = ddlCategory.SelectedValue;
dynamic categoryTextBox = FormView1.FindControl("CategoryIDText

how can i display the selected value of dropdownlist from edittemplate to label from itemtemplate?


I have a detailsview with a dropdownlist in it. the detailsview is connected to a database table(employees having the following fields: id-smallint,name-nvarchar, departmnet-smallint). the ddl is connected to another table (departments with the following fields: id-smallint, departmentName-nvarchar). the ddl is in the edititemTempalte of the department field. My goal is to display in  the itemtemplate the departmentName (the selected value from the edititemtemplate ). How can I do this? Doyou have any ideas?

thanks a lot

Formview PagerTemplate DropDownList Navigation


Does anyone know if its possible to use a DropDownList within the PagerTemplate to navigate to a specific record?  I have been able to place the DropDownList outside of the FormView and PagerTemplate and make it work, however, I can't get it to work inside the PagerTemplate.


Formview + EditItemTemplate + Bind + PageLoad + Prerender = Confused


I am working with a formview edititemtemplate.  Currently in my page load, i have some stuff that would show or hide certain panels based on dropdownlist values.  These dropdown values get binded during page load.  I need to be able to change the values/dropdowns, without rebinding the old data, and updating the visibility of the panels based on predefined rules.

I have experimented with putting my formview.databind() in page load if isnotpostback, in prerender, in prerender if isnotpostback.   I have tried my rules (ex if ddlState.selectedvalue = "DE" then pnlDelaware.visible = "true") in the page load, and the page render.   I'm just not sure how to get the stars aligned here.

The closest i have come is having the databind in the pageload if notispostback, and the rules in the prerender.   However I get an error "dropdownlist has a SelectedValue which is invalid because it does not exist in the list of items.


CheckBoxList embedded in FormView InsertItemTemplate problem


I've searched hi/lo and found many similar posts but those answers aren't working for me.

I've got a FormView, in an UpdatePanel.  In the FormView's EditItemTemplate and InsertItemTemplate I'm using both a CheckBox and a CheckBoxList.  To present the data I databind in the code behind, (but then have to iterate to mark selected).  There I cast the sender as CheckBoxList in the OnPreRender event and use that object. 

The problem is retrieval.  I'm trying to access the user's entries when they submit by using the cast.  It is working fine for the CheckBox, but for the CheckBoxList the resulting checkboxlist object doesn't have any items. 

Here, both active and roles are created (they're not 'null') and active has the expected 'name' and 'selected' values, but roles has an item count = 0 and the for loop isn't entered.


            CheckBox active = ((CheckBox)Emp_Form.FindControl("cbActive"));

            CheckBoxList roles = (CheckBoxList)Emp_Form.FindControl("UsrRoles");

            foreach (ListItem role in roles.Items)
                // do stuff


Is there another way to cast a checkboxlist?  Any help would b

jQuery radiobuttonlist

Hi,I'm trying to show/hide a div based on the selected value of radiobuttonlist using jQuery (1.3.2.min). I've tried a thousand different methods and can't get any of them to work :( I have the following code so far:<asp:RadioButtonList ID="rdbMeds" CssClass="assess" RepeatLayout="Flow" RepeatDirection="Horizontal" runat="server"> <asp:ListItem value="yes">Yes</asp:ListItem> <asp:ListItem value="no" Selected="true">No</asp:ListItem> </asp:RadioButtonList> <div id="rdbMeds_hid"> If yes, please specify what it is for: <asp:TextBox ID="tbMeds" CssClass="textboxnormal" runat="server" /> </div> And I have the following jQuery:$(document).ready(function(){$("#rdbMeds").change(function(){//If checkedif ($("#rdbMeds").attr(":checked")){//show the hidden div$("#rdbMeds_hid").show("fast");} else { //otherwise, hide it $("#rdbMeds_hid").hide("fast");}});});Any help would be much appreciated.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend