Hi,
As a Telerik newbie, I'd like to seek some wisdom on RadGrid implementation. I have a single ASP.NET page that is structured with two custom user controls: one for getting user inputs and another for displaying results based on inputs. The custom controls look like the following:
When user makes proper selection on ctrlInput and then click on submit button, BtnClickEvent will be raised to the containing aspx page, which looks like this:
When myGrid_NeedDataSource fires for the first time, there's nothing to pass to GetData because Foo_btnClickEvent, which contains user's inputs, is always fired "afterwards". Can someone please shed some lights on how to achieve this or even suggest a better design/implementation?
Thanks in advance,
As a Telerik newbie, I'd like to seek some wisdom on RadGrid implementation. I have a single ASP.NET page that is structured with two custom user controls: one for getting user inputs and another for displaying results based on inputs. The custom controls look like the following:
// ctrlInput.ascx.cs// consists of several controls (dropdown lists, checkboxes and a submit button) public event EventHandler BtnClickEvent;protected void Btn_Click(object sender, EventArgs e){ BtnClickEvent(this, e);}//ctrlRadGrid.ascx.cs//display result table based on ctrlInput values public event EventHandler MyGridNeedDataSource; protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e){ MyGridNeedDataSource(this, e);}When user makes proper selection on ctrlInput and then click on submit button, BtnClickEvent will be raised to the containing aspx page, which looks like this:
// MyPage.aspx.cx protected void Page_Init(object sender, EventArgs e){ ctrlInput1.BtnClickEvent += new EventHandler(Foo_btnClickEvent); ctrlRadGrid1.MyGridNeedDataSource += new EventHandler(myGrid_NeedDataSource);} protected void Page_Load(object sender, EventArgs e){ // toggle panel visibility if (!IsPostBack) { pnlInputs.Visible = true; pnlResults.Visible = false; } else { pnlInputs.Visible = false; pnlResults.Visible = true; }} protected void myGrid_NeedDataSource(object sender, EventArgs e){ if (ViewState["MyParams"] != null)
{
myGrid.DataSource = GetData(ViewState["MyParams"]);
}} protected void Foo_btnClickEvent(object sender, EventArgs e){ var ctrl = (ctrlInput)sender;
ViewState["MyParams"] = ctrl.InputParams;}private DataTable GetData(string param){ //DONE: call stored procedure with param}When myGrid_NeedDataSource fires for the first time, there's nothing to pass to GetData because Foo_btnClickEvent, which contains user's inputs, is always fired "afterwards". Can someone please shed some lights on how to achieve this or even suggest a better design/implementation?
Thanks in advance,