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

Top 5 Contributors of the Month
Gaurav Pal
" yc=""><tr>
"><td> <strong> Gender: </ strong> </ td>
Post New Web Links

Help with checkboxlist in formview edittemplate data display

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :ASP.Net


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") %>' 

View Complete Post

More Related Resource Links

Display data in gridview dynamicallay

I have AD domain which has 100000 users, I want to display all the users in gridview controls.Actually it is displaying users in gridview after parsing entire domain which takes around 30 min. I want to display the users while loading itself.It is continously getting user information from AD domain and getting each user details, I want to display the users information which already queried instead of waiting till getting all users information

asp.net display data in gridview

i want to display data in gridview binded to a sql datasource
but the problem part is i want to bind a field of that datasource to a dropdownlist and when a item is selected in that dropdownlist then correcposnding to that data will be displayed in gridview...

display data into GridView from excel sheet

I have to display data from excel sheet into my gridview and also I need to figure out a way to store data into excel files from my web page. I am using C# 3.5, VS 2008.

Display Related Data in an ASP.NET GridView

Typically when you display a datagrid you will want to show data from a related table. There are 3 different ways to accomplish this with NetTiers. You can use a custom stored procedure, deepload functionality from the code behind, or a strongly typed datasource control. We'll provide an example of each

display data in excel 2007


 I am using .net  version 1.1  and  excel 2003 to display data.I need to display data in 2007 .Can  anyone suggest the reference to be added ,connection string change and what should be imported.  

Data and WPF: Customize Data Display with Data Binding and WPF


Here we present techniques for programmatic and declarative data binding and display with Windows Presentation Foundation.

Josh Smith

MSDN Magazine July 2008

SQL Server: Display Your Data Your Way with Custom Renderers for Reporting Services


SQL Server 2005 Reporting Servicesis a great tool that offers a centralized approach to storing and rendering reports. It also lets users view and download reports without installing additional software. Plus, reports can be saved in any number of different formats using custom report renderers. In this article, the author will develop one such report renderer that outputs HTML reports, but the skills you'll learn can easily be used to create a renderer for Microsoft Word documents or any other format of your choosing.

James Yip

MSDN Magazine February 2005

Best way to display this data?


I'm playing around with the data format below, trying to find the best way to display it (Gridview, repeater, datatable, etc)

I will have anywhere from 1 to 4 columns of data.

The first two rows will come from the database.

The third row is user input.

Rows 4 & 5 are also user input, but they could enter multiple values for each one. Each value will create a new row.

Rows 6 & 7 come from a previous page.

Rows 8 & 9 are like 4 & 5 above.

The last row is a total row, summing up everything above.

Anyone have an idea on the best way to display this to provide the functionality of adding rows for 4,5,8, and 9?

I was leaning towards a DataList but I keep going back and forth.

Any thoughts would be appreciated.


Display multivalue data in crystal report


i Want to show data for single employee like this like this

Emp Id : xyz

Emp Name : abc


Child name      Date of birth     education

abc                     12/12/2000    o levels

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

Sharepoint list group by column data ,display in webcontrol like panel or label


I  have a sharepoint list[Managers] with groupby sector column. like below




Each Sector group by column data i want to display in label or panel control.

How to do that ? how to write the logic?



Regards, Mansoor

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


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")%> &#

Data form web part not displaying - Unable to display this Web Part. ....



I am designing a data form - adding some formatting etc.  I am able to see the webpart correctly in SPD split view, but when I trying to preview it, it gives me the following error

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.
ANy help would be welcome, I have spent a lot of time on this page and don't want to do it again.  THere are a lot of fields and it's a tedious process to move them to the correct location.  I am at my wits end, I am not sure how to debug this!!


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

Microsoft Report Viewer control to display data on one page


Hello everyone,

I am wondering if the Microsoft Report Viewer control allows for display changes.  Say for instance a user wants would like to see all the data requested then another time would like to toggle thru the pages of infomation.  So does anyone know if the control allows for display changes from complete view to paginated viewing.  I am using MS VS 2008 with ASP.NET 3.0.  Thanks for your response.


How to perform math on a column of data in SQL database and display it in my VB app

Sorry if this is the wrong forum, cos it's SQL and VB2010 So I have my sqlserver database 3.5 compact editon called "Dive Club Records" and in it are stored columns of dive trip information and I want tthe user to be able run a query from my VB2010 application to sum a divers total dive hours and display it on the form, eg: MemberID, FirstName, LastName, DiveTime by the way divetime is a real number recorded as 15.5, 20.5, 5.0 etc What is the easiest way to do this? Would prefere to do it from within VB2010 code if possible or make a query from the datagrid on my form using query designer. thanks for any suggestions from you all, hope you can keep them simple for me :)   regards   paul   paul
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