// add a widget to the list
public void Add(RemoteWidget w)
{
// read parameters from Request
w.CollectParams(m_page.Request);
// assign an ID for the module
string w_id = next_id.ToString();
++next_id;
w.ID = w_id;
// work out URLs that will flag a post to this module
string url = m_postback_url_prefix + m_param_prefix;
w.AjaxURL = url + "ajax=" + w.ParamPrefix;
w.PostURL = url + "post=" + w.ParamPrefix;
// see if the current request is a POST or AJAX call to this module
if (m_post_target == w.ParamPrefix)
{
w.Method = "post";
target = w;
}
else if (m_ajax_target == w.ParamPrefix)
{
w.Method = "ajax";
target = w;
}
// and finally keep track of it so we can request it later from the srver
m_widgets[w_id] = w;
}