making checkboxlist checked comparing it with integer value

Discussion in 'ASP .Net Web Controls' started by a developer, Nov 11, 2004.

  1. a developer

    a developer Guest

    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;
    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;
    ckbxListSites.SelectedItem.Value=strValue;
    }................................................plz suggest me
    how can i make checkboxlist check
     
    a developer, Nov 11, 2004
    #1
    1. Advertising

  2. a developer

    azam Guest

    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;
    ckbxListSites.SelectedValue = strValue;
    }
    /////////////////////



    "a developer" <a > wrote in message news:<>...
    > 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;
    > 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;
    > ckbxListSites.SelectedItem.Value=strValue;
    > }................................................plz suggest me
    > how can i make checkboxlist check
     
    azam, Nov 12, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rik
    Replies:
    0
    Views:
    3,255
  2. yurps
    Replies:
    1
    Views:
    6,987
    rajeshthangarasu1983
    Feb 29, 2008
  3. Wayne  Wengert

    Marking CheckBoxList Items as Checked

    Wayne Wengert, Mar 2, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    32,723
    Wayne Wengert
    Mar 2, 2005
  4. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    Problem reseting CheckBoxList when not checked.

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Jun 23, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    465
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=
    Jun 23, 2005
  5. Replies:
    0
    Views:
    534
Loading...

Share This Page