Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7782863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:40:24+00:00 2026-06-01T19:40:24+00:00

protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session[SavedSQLSources] == null)

  • 0
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["SavedSQLSources"] == null)
                SavedSQLSources = new Dictionary<String, SqlDataSource>();

            SavedSQLSources.Add(ASPxComboBox1.ID, SqlDataSource1);
            SavedSQLSources.Add(ASPxComboBox2.ID, SqlDataSource2);

            Session["SavedSQLSources"] = SavedSQLSources;
        }
        else
        {
            if (Session["SavedSQLSources"] != null)
                SavedSQLSources = (Dictionary<String, SqlDataSource>)Session["SavedSQLSources"];
        }
    }

Greetings, I have multiple ASPxCombobox with each having their own datasource. So first I saved
each control ID with their corresponding datasource object in a dictionary.

    protected void Cmb_Callback(object source, CallbackEventArgsBase e)
    {
        ASPxComboBox comboBox = (ASPxComboBox)source;
        string[] args = e.Parameter.Split('|');

        for (int i = 0; i < args.Length; ++i)
            SavedSQLSources[comboBox.ID].SelectParameters[i].DefaultValue = args[i];
        comboBox.DataSourceID = SavedSQLSources[comboBox.ID].ID;
        comboBox.DataBind();
    }

Doing a few actions on the page, each control then launch its callback and bind its data with the corresponding datasource.

Well… Work perfectly when using directly the datasource, but having no items fetched when it’s from a datasource saved in Session (from SavedSQLSources).
Shouldn’t the instance of the object be the same ?

Thanks in advance, TheRainFall.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:40:25+00:00Added an answer on June 1, 2026 at 7:40 pm

    Ok, I gave up on the dictionnary method and resolved this by linking each ASPxCombobox to its SqlDatasource from client-side:

    DataSourceID="SqlDataSource1"
    

    Then in the callback I got the sqldatasource instance from the parent container by using the datasourceID referenced from client-side:

    SqlDataSource tempSqlDatasource= (SqlDataSource)comboBox.Parent.FindControl(comboBox.DataSourceID);
    

    The main purpose was to reload all combobox without reloading the page although I could have done this client-side only.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Then: protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CheckBoxList1.Items.Add(new ListItem(item1)); CheckBoxList1.Items.Add(new
this is the simple code: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack)
Shouldn't PostBack be checked before Session protected void Page_Load(object sender, EventArgs e) { if
Code Behind (C#): protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack)
I have this code: protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) {
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Response.Cache.SetCacheability(HttpCacheability.NoCache ); Response.Cache.SetAllowResponseInBrowserHistory(false); }
In the pageload i populate a dropdownlist like this: protected void Page_Load(object sender, EventArgs
On PostBack, from clicking on an ImageButton, it first hits protected void Page_Load(object sender,
I have AutoEventWireup=true and in my code behind protected void Page_Init(object sender, EventArgs e)
protected void Button3_Click(object sender, EventArgs e) //export { GridView2.AllowPaging = false; GridViewExportUtil.Export(Сводка.xls, this.GridView2); GridView2.AllowPaging

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.