Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > making checkboxlist checked comparing it with integer value

Reply
Thread Tools

making checkboxlist checked comparing it with integer value

 
 
a developer
Guest
Posts: n/a
 
      11-11-2004
i want to make checkboxlixt check or unkchek on the basis of certain values
like 1,2,3 here my checkboxlist have values like 1,2,3, now i m storing
values (integer types like 1,2,3,4,5,6, etc. ) and coparing these values
with checkboxlist's values but getting error as ..........
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:


Line 274: {
Line 275: string strValue=strArr[i];
Line 276: ckbxListSites.SelectedItem.Value=strValue;
Line 277: }
Line

.................................................. .................................................. ...................
my coding is
.................................................. .............................


...string strSiteCodes=Convert.ToString(ds.Tables[0].Rows[0]["Site"]);
string[] strArr=strSiteCodes.Split(',');
int j=strArr.Length;
for(int i=0;i<j;i++)
{
string strValue=strArr[i];
ckbxListSites.SelectedItem.Value=strValue;
}................................................p lz suggest me
how can i make checkboxlist check

 
Reply With Quote
 
 
 
 
azam
Guest
Posts: n/a
 
      11-12-2004
Hello,
Check if this works.
/////////////////////
string strSiteCodes= ds.Tables[0].Rows[0]["Site"].toString();
string[] strArr=strSiteCodes.Split(',');
int j=strArr.Length;

for(int i=0;i<j;i++)
{
string strValue=strArr[i];
ckbxListSites.SelectedValue = strValue;
}
/////////////////////



"a developer" <a http://www.velocityreviews.com/forums/(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> i want to make checkboxlixt check or unkchek on the basis of certain values
> like 1,2,3 here my checkboxlist have values like 1,2,3, now i m storing
> values (integer types like 1,2,3,4,5,6, etc. ) and coparing these values
> with checkboxlist's values but getting error as ..........
> Exception Details: System.NullReferenceException: Object reference not set
> to an instance of an object.
>
> Source Error:
>
>
> Line 274: {
> Line 275: string strValue=strArr[i];
> Line 276: ckbxListSites.SelectedItem.Value=strValue;
> Line 277: }
> Line
>
> .................................................. .................................................. ...................
> my coding is
> .................................................. ............................
>
>
> ..string strSiteCodes=Convert.ToString(ds.Tables[0].Rows[0]["Site"]);
> string[] strArr=strSiteCodes.Split(',');
> int j=strArr.Length;
> for(int i=0;i<j;i++)
> {
> string strValue=strArr[i];
> ckbxListSites.SelectedItem.Value=strValue;
> }................................................p lz suggest me
> how can i make checkboxlist check

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CheckBox Checked=false when checked in DataList yurps ASP .Net 1 02-29-2008 01:08 PM
Bind to a checkboxlist - need some checkboxes checked hooterbite@yahoo.com ASP .Net 0 06-30-2006 10:19 AM
Problem reseting CheckBoxList when not checked. =?Utf-8?B?UGF0cmljay5PLklnZQ==?= ASP .Net 1 06-23-2005 06:51 AM
Marking CheckBoxList Items as Checked Wayne Wengert ASP .Net 7 03-02-2005 03:43 PM
DataBind CheckBoxList and setting checked value Rik ASP .Net 0 09-08-2004 09:09 AM



Advertisments