Groups | Blog | Home
all groups > asp.net webcontrols > november 2004 >

asp.net webcontrols : making checkboxlist checked comparing it with integer value


a developer
11/11/2004 3:18:03 PM
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;
}................................................plz suggest me
how can i make checkboxlist check
syedazam23 NO[at]SPAM hotmail.com
11/11/2004 10:19:41 PM
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;
}
/////////////////////



[quoted text, click to view]
AddThis Social Bookmark Button