Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a dridview with data source from my database,

my problem is I have a Tutorial but the data is from xml..

My data is from database, how to change it??

THIS TUTORIAL merge data from XML

I WANT TO CREATE A CODE THAT MERGE DATA FROM DATABASE.
AND I DONT KNOW HOW TO DO THAT...


C#
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindGridView();
        }
    }

    protected void gridView_PreRender(object sender, EventArgs e)
    {
        if (rbl.SelectedIndex == 1)
        {
            GridDecorator.MergeRows(gridView);
        }
    }
    protected void rbl_SelectedIndexChanged(object sender, EventArgs e)
    {
        BindGridView();
    }
    void BindGridView()
    {
        DataSet dataSet = new DataSet();
        dataSet.ReadXml(Server.MapPath("~/App_Data/data1.xml"));

        gridView.DataSource = dataSet;
        gridView.DataBind();
    }
}
Posted
Updated 28-Feb-14 15:10pm
v4
Comments
CHill60 28-Feb-14 21:05pm    
Your question is not entirely clear. Change what? What exactly is the problem?
ZurdoDev 28-Feb-14 21:21pm    
Load the DataSet from SQL. If you do not know how there are many examples online.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900