CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Checkbox Help

  1. #1
    Join Date
    Jul 2009
    Posts
    1

    Red face Checkbox Help

    I am making an admin page that modifies other pages on the site.

    I'd really just like some feedback on my logic as I'm stuck and am still a beginner.

    Ok so the page I made modifies the Links page of our site (A page with a list of important links)

    My manager wanted to be able to change the links on this page simply without dealing with code.

    I currently have a site that the use can input, Link Title, URL, and then update the links page.

    Now on our main page there is also a small section with the 'Top Links' from the link page.

    On my Modify Links Page, I have created a check box below each input link area but am now stuck.

    How would I write a function that performed this action, or does this logic make sense?


    If Checkbox is checked
    {
    Show on main page
    }
    else
    {
    Do nothing
    }


    I'm sorry if this question is too broad or unclear. Thanks for any help in advance.

  2. #2
    Join Date
    Jul 2006
    Posts
    297

    Re: Checkbox Help

    Well my advise is to either store all the links in a database or xml file. Make sure to include whether its checked or not. Then when you're displaying the links on the page you can filter out all the ones which are not checked.

    Assuming your xml looked like this.

    Code:
    <links>
         <link checked="true">
              <name>Google</name>
              <url>http://google.com</url>
         </link>
         <link checked="false">
              <name>Google</name>
              <url>http://google.com</url>
         </link>
    </links>
    You could use the following code to get only the list of links that are checked

    Code:
    XmlDocument xml = new XmlDocument();
    xml.Load(filename);
    
    XmlNodeList activeLinks = xml.SelectNodes("links/link[@checked='true']");

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured