Click here to Skip to main content
11,796,631 members (73,590 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#2.0
i am working for cms in which the all the pages are created dynamically now the thing is that i have get back all the title from database to the menu strip, now when i click on the page i..e title it has to get content from database where all this contain in the one table of the database i..e how i can redirect to that page dynamically.for this i have written a for it

public partial class menu : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
    DataSet GetMenuData()
        SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=newdata23;User ID=sa;Password=123");
        SqlDataAdapter dadCats = new SqlDataAdapter("SELECT cms_title FROM cms", con);
        //SqlDataAdapter dadProducts = new SqlDataAdapter("SELECT * FROM Products", con);
        DataSet dst = new DataSet();
        dadCats.Fill(dst, "cms");
        return dst;
    public void PopulateMenu()
        DataSet dst = GetMenuData();
        foreach (DataRow masterRow in dst.Tables["cms"].Rows)
            MenuItem masterItem = new MenuItem((string)masterRow["cms_title"]);
Posted 28-Jan-13 5:52am
Edited 28-Jan-13 6:11am
Sergey Alexandrovich Kryukov at 28-Jan-13 19:25pm
At least put a question mark after your question — I almost deleted this post. Please understand: we are haunted by a great number of non-questions, so, if you don't show your question very clearly, there is a chance of accidental removal of it, so you would need to do it again.
jibesh at 28-Jan-13 20:13pm
In Addition to Sergeys comment, do not use text word use proper words and statements. not every one here likes to read text words.
DanielSheets at 31-Jan-13 15:15pm
Too bad I can't upvote this.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Please refer links:
1) Link1
2) Link2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 505
1 Abhinav S 417
2 OriginalGriff 360
3 CPallini 285
4 KrunalRohit 249
0 OriginalGriff 2,012
1 Maciej Los 1,725
2 KrunalRohit 1,310
3 CPallini 1,055
4 ppolymorphe 858

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 30 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100