1

我有这样的东西......

switch (PostBackControlParentId)
            {
                case "":
                    SearchResults.InnerText = "Sorry. There was an Error.";
                    break;
                case "GamesTabUpdatePanel":
                    Var_Games_Platform = PlatformDropdown.SelectedValue;
                    Var_Games_Rating = Convert.ToDecimal(Games_RatingTextBox.Text);
                    Var_Games_Developer = DeveloperDropdown.SelectedValue;
                    Var_Games_Publisher = PublisherDropdown.SelectedValue;
                    Var_Games_Year = Convert.ToInt16(YearDropdown.SelectedItem.Value);
                    if (Games_OnlyAvailableCheckBox.Checked)
                    {
                        Var_Games_AvailableOnly = true;
                    }

                    foreach (ListItem Genre in Games_GenreList.Items)
                    {
                        if (Genre.Selected)
                        {
                            SearchResults.InnerText = SearchResults.InnerText + Genre.ToString();
                            Var_Games_Genres.Add(Genre.Value.ToString());**///The line of interest........**
                        }
                    }
                    //Get Query Data..
                    //Pass to SQL
                    //Get DataSet
                    //WriteStuff.
                    break;
                case "MoviesTabUpdatePanel":
                    break;
                case "EpisodesTabUpdatePanel":
                    break;
                case "TVShowsTabUpdatePanel":
                    break;
            }

现在,当我不这样做时

Var_Games_Genres.Add(Genre.Value.ToString()); ///感兴趣的线......

UpdatePanel 完全显示了我想要的内容..(名为 Games_GenreList 的复选框列表中的选定游戏流派列表。但是当我添加以下行时 Var_Games_Genres.Add(Genre.Value.ToString()); ///感兴趣的行.. ...... 它不会改变更新面板上的任何东西。我也在谷歌浏览器的控制台上得到这个......

Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object. ScriptResource.axd:847
Error$create ScriptResource.axd:847
PageRequestManager$_createPageRequestManagerServerError ScriptResource.axd:766
PageRequestManager$_parseDelta ScriptResource.axd:1653
PageRequestManager$_onFormSubmitCompleted ScriptResource.axd:1414
(anonymous function) ScriptResource.axd:628
(anonymous function) ScriptResource.axd:4338
raise ScriptResource.axd:7429
WebRequest$completed ScriptResource.axd:7433
XMLHttpExecutor._onReadyStateChange ScriptResource.axd:6857

我真的不知道出了什么问题。谢谢你。

4

1 回答 1

0

尝试

List Var_Games_Genres = new List();

在开关盒之前

于 2013-01-05T18:40:39.180 回答