checkbox?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pavankumar106
    New Member
    • Feb 2008
    • 11

    checkbox?

    hi i need to update checkbox values to database which is in formview control depending upon wat the user selects?
    i ve written the code lik dis but here its updating depending upon the first checkbox
    for ex if the first checkbox is true its taking the remaining checkboxes values also as true no matter if their value is false and the same happens for viceversa?
    can any1 help me regarding dis?
    the code i ve written is below
    [code=cpp]
    CheckBox EmployeeRequest UploadedMailInt ranet = ((CheckBox)frmv iewpreference.F indControl("chk bxClientRegisMa il"));
    bool EmployeeRequest UploadMailIntra net=EmployeeReq uestUploadedMai lIntranet.Check ed;
    CheckBox EmployeeRequest UploadedInterne t = ((CheckBox)frmv iewpreference.F indControl("chk bxClientRegisMa il"));
    bool EmployeeRequest UploadInternet= EmployeeRequest UploadedInterne t.Checked;
    //Updating the preferences of the client using SqlHelper.
    SqlHelper.Execu teNonQuery(tran s, CommandType.Tex t, "Update tClient set EmployeeRequest UploadedMailInt ranet='" + EmployeeRequest UploadMailIntra net + "',EmployeeRequ estUploadedInte rnet='" + EmployeeRequest UploadInternet + "' where ClientID=" + Session["clientId"]);
    lblmsg.Text = "Preference s Updated";[/code]
    Last edited by Frinavale; Mar 14 '08, 03:18 PM. Reason: added [code] tags
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by pavankumar106
    hi i need to update checkbox values to database which is in formview control depending upon wat the user selects?
    i ve written the code lik dis but here its updating depending upon the first checkbox
    for ex if the first checkbox is true its taking the remaining checkboxes values also as true no matter if their value is false and the same happens for viceversa?
    can any1 help me regarding dis?
    the code i ve written is below
    [code=cpp]
    CheckBox EmployeeRequest UploadedMailInt ranet = ((CheckBox)frmv iewpreference.F indControl("chk bxClientRegisMa il"));
    bool EmployeeRequest UploadMailIntra net=EmployeeReq uestUploadedMai lIntranet.Check ed;
    CheckBox EmployeeRequest UploadedInterne t = ((CheckBox)frmv iewpreference.F indControl("chk bxClientRegisMa il"));
    bool EmployeeRequest UploadInternet= EmployeeRequest UploadedInterne t.Checked;
    //Updating the preferences of the client using SqlHelper.
    SqlHelper.Execu teNonQuery(tran s, CommandType.Tex t, "Update tClient set EmployeeRequest UploadedMailInt ranet='" + EmployeeRequest UploadMailIntra net + "',EmployeeRequ estUploadedInte rnet='" + EmployeeRequest UploadInternet + "' where ClientID=" + Session["clientId"]);
    lblmsg.Text = "Preference s Updated";[/code]
    You are setting both EmployeeRequest UploadedMailInt ranet and EmployeeRequest UploadedInterne t to the same value...being:
    [code=cpp]((CheckBox)frmv iewpreference.F indControl("chk bxClientRegisMa il"));[/code]

    This is why both of your values are the same.

    Cheers!
    -Frinny

    Comment

    Working...