Приложение — система голосования.
Организовано след. образом. В классе страницы обьявлен делегат
delegate void PageCommand(request _request);
в файле request.cs
public class request
{
private String _CmdText;
private ArrayList arParams;
public request(NameValueCollection col)
{
_CmdText = col["CmdText"];
arParams = new ArrayList();
arParams.Add(col["FirstParam"]);
arParams.Add(col["SecondParam"]);
}
public String CmdText
{
get {return _CmdText;}
}
public String GetParam(int i){return arParams[i].ToString();}
}
Page_Load работает след. образом
protected virtual void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack) commands = LoadHandlers();
request req = new request(Request.Form);
PageCommand command;
if (!IsPostBack)
command = (PageCommand)commands["Page_Load"];
else
command = (PageCommand)commands[req.CmdText];
command(req);
}
где LoadHandlers такая
protected virtual Hashtable LoadHandlers()
{
Hashtable commands = new Hashtable();
commands["Topic_Create"] = new PageCommand(this.CreateTopic);
commands["Page_Load"] = new PageCommand(this.InitPage);
return commands;
}
Теперь непонятности. В ответ на запрос Topic_Create программа в CreateTopic входит но нужного результата функция не достигает.
protected void CreateTopic(request _req)
{
Response.Write("1");
lbInfoPanel.Text = "<div class='header' align=center>Создание нового голосования<br>";
lbInfoPanel.Text += "<table border=1 width=100%>"
+ "<tr>"
+ "<td width=40% valign='top' class='header'>Название</td>"
+ "<td width=60%><input name='QuestionName' type='text' style='width: 100%'></td>"
+ "</tr>"
+ "<tr>"
+ "<td width=40% class='header' valign='top'>Вопрос</td>"
+ "<td width=60%><input name='Question' type='text' style='width: 100%'></td>"
+ "</tr>"
+ "<tr>"
+ "<td width=40% class='header' valign='top'>Варианты ответов</td>"
+ "<td width=60%><textarea rows=10 name='Variants' style='width: 100%'></textarea></td>"
+ "</tr>"
+ "</table>"
+ "<input type='button' value='Добавить голосование' onclick='PostBack(\"Topic_AddNew\");'></div>";
}
При попытке в этой функции прямо аписать что-нибудь в Response, прога ругается вот так нехорошо
Response is not available in this context.
Но если сделать так, чтобы CreateTopic вызывался при первой загрузке, то всё пашет
Я в дауне

, где ошибка??????
... <<Metallica — Outlaw Torn >>