User Profile & Activity

Shawn Craig Member

Hope this helps you out. I cut and pasted it from something I was working on. Let me know if it doesn't work.

namespace WebApplication4
{
    public partial class _Default : System.Web.UI.Page
    {
        DataSet dsFedApps;

        protected void Page_Load(object sender, EventArgs e)
        {
            DataSet dsAppList = new DataSet();
            dsAppList.Tables.Add(AppTableAdapter.GetData());
            dsAppList.Tables.Add(PropTableAdapter.GetData(0));

            DataRelation rel;
            rel = new DataRelation("relAppProps",
                dsAppList.Tables["AppList"].Columns["FedAppsID"],
                dsAppList.Tables["PropList"].Columns["FedAppsID"]);
            dsAppList.Relations.Add(rel);
        }

        protected void WebGrid1_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
        {
            e.DataSource = dsFedApps;
            WebGrid1.DataMember = "AppList";
            WebGrid1.RootTable.DataMember = "AppList";
        }

        protected void WebGrid1_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WebGrid1.ClearCachedDataSource();
                WebGrid1.RetrieveHierarchicalStructure();
            }
        }
    }
}
All times are GMT -5. The time now is 10:04 PM.
Previous Next