Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 22nd, 2004, 06:26 AM
Authorized User
 
Join Date: Aug 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem With CheckBoxList, PLEASE HELP!!!

I am having trouble with a checkboxlist.

When the webpage loads, a checkboxlist is displayed along with some other form fields and buttons. Some checkboxes are ticked depending on whether or not there was an entry for them in a database. All of the fields are disabled, including the checkbox list.

There is an update button on the page, when it is pressed, the form fields are enabled. Everything works fine except that the checkboxlist is reset, no checkboxes are ticked anymore. I don't understand why this is so but it is.

Below is the code that is used to view the form fields, cbl_Sections is the name of the checkboxlist:

    Sub ViewRecord(str_RecID As string)
        Table1.Visible = False
        Table2.Visible = True

        lblFilter.Visible = False
        str_Filter.Visible = False
        btnFilter.Visible = False

        btnAddNew.Visible = True
        btnList.Visible = True
        btnUpdate.Visible = True
        btnDelete.Visible = True
        btnSave.Visible = False
        btnCancel.Visible = False

        btnAddNew.CommandArgument = "PAGE"

        str_ArticleID.ReadOnly = True
        str_ArticleTitle.ReadOnly = True
        str_Keywords.ReadOnly = True
        str_MetaTags.ReadOnly = True
        str_PageTitle.ReadOnly = True
        str_PageName.ReadOnly = True
        str_SpecialText.ReadOnly = True
        str_ArticleText.ReadOnly = True

        ddl_Special.Enabled = False
        ddl_Active.Enabled = False

        cbl_Sections.Enabled = False

        articleObj.setObject(str_RecID)

        str_ArticleID.text = str_RecID
        str_ArticleTitle.text = articleObj.getArticleTitle()
        str_Keywords.text = articleObj.getKeywords()
        str_MetaTags.text = articleObj.getMetaTags()
        str_PageTitle.text = articleObj.getPageTitle()
        str_PageName.text = articleObj.getPageName()
        str_SpecialText.text = articleObj.getSpecialText()
        str_ArticleText.text = articleObj.getArticleText()

        if articleObj.getIsSpecial()
            ddl_Special.SelectedIndex = 0
        else
            ddl_Special.SelectedIndex = 1
        end if

        if articleObj.getDisplay()
            ddl_Active.SelectedIndex = 0
        else
            ddl_Active.SelectedIndex = 1
        end if

        articleObj.CheckSections(cbl_Sections)
    End Sub

Next is the code that is executed when the update button is pressed:

    Sub btnClick_Update(Sender As Object, E As EventArgs)
        if not articleObj.checkInUse(CStr(str_ArticleID.Text))
            articleObj.setInUse(CStr(str_ArticleID.Text))

            btnAddNew.Visible = False
            btnUpdate.Visible = False
            btnDelete.Visible = False
            btnList.Visible = False

            str_ArticleTitle.ReadOnly = False
            str_Keywords.ReadOnly = False
            str_MetaTags.ReadOnly = False
            str_PageTitle.ReadOnly = False
            str_PageName.ReadOnly = False
            str_SpecialText.ReadOnly = False
            str_ArticleText.ReadOnly = False

            ddl_Special.Enabled = True
            ddl_Active.Enabled = True

            cbl_Sections.Enabled = True

            btnSave.Visible = True
            btnCancel.Visible = True
            btnSave.CommandArgument = "UPDATE"
            btnCancel.CommandArgument = "UPDATE"
        else
            Me.ViewRecord(CStr(str_ArticleID.Text))
        end if
    End Sub

Any help would be greatly appreciated.

Thanks:(:(:(

 
Old November 24th, 2004, 01:08 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

when you click on update, a Post Back occurs, you have to run the code that sets the checks in the check boxes again.






Similar Threads
Thread Thread Starter Forum Replies Last Post
repopulating CheckBoxList from db table problem enginev ASP.NET 2.0 Basics 0 April 1st, 2008 07:22 AM
Checkboxlist epkgupta Visual Studio 2005 0 March 11th, 2008 05:31 AM
CheckBoxList stu9820 ASP.NET 1.0 and 1.1 Basics 10 May 25th, 2006 08:15 PM
Checkboxlist problem sansircar ASP.NET 1.0 and 1.1 Professional 1 March 12th, 2006 01:36 AM
CheckBoxList eddiema VS.NET 2002/2003 1 April 9th, 2004 09:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.