Click here to Skip to main content
15,908,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi im getting errors in this ...default.aspx.cs page
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace data_binding_in_asp.net
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string c = string.Empty;
            for (int i = 0; i = CheckBoxlist1.items.count; i++)
            {
                if (CheckBoxlist1.item[i].Selected)
                {
                    c += CheckBoxlist1.item[i].value + "-->" + CheckBoxlist1.item[i].text + "<br/>";
                }
            }
        }
Posted
Updated 28-Jan-14 19:08pm
v2
Comments
And what is that error message?

1 solution

Syntax Error:[^]
try this code..

C#
protected void Button1_Click(object sender, EventArgs e)
        {
            string c = string.Empty;
            for (int i = 0; i < CheckBoxlist1.Items.Count; i++)
            {
                if (CheckBoxlist1.Items[i].Selected)
                {
                    c += CheckBoxlist1.Items[i].Value + "-->" + CheckBoxlist1.Items[i].Text + "<br/>";
                }
            }
        }
 
Share this answer
 
v2
Comments
harshavardhan12345678 29-Jan-14 1:20am    
thanks bro. but again getting same problem
Karthik_Mahalingam 29-Jan-14 1:26am    
can u pls post the error message.
by the way, check this name : CheckBoxlist1 it is CheckBoxList1 i guess..
harshavardhan12345678 29-Jan-14 1:27am    
Error 4 The name 'CheckBoxlist1' does not exist in the current context c:visual studio 2010\Projects\data binding in asp.net\data binding in asp.net\Default.aspx.cs 20 33 data binding in asp.net
harshavardhan12345678 29-Jan-14 1:28am    
Error 2 } expected c:\\visual studio 2010\Projects\data binding in asp.net\data binding in asp.net\Default.aspx.cs 27 10 data binding in asp.net
Karthik_Mahalingam 29-Jan-14 1:29am    
add a } bracket at the end of the function..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900