Feb 24, 2012, 9:08 AM
[CLOSED] Combobox Direct Event
Hi,
I wanna refresh my grid when combobox changed.There are data and colomnCollection in onload method, I wanna refresh them when gridRefresh Method is called by combobox select event. data and colomnCollection uses for creating new grid with new data and new columns.
But the problem is, event handler is not work when event change, After all operation in onlad method finish, gridrefresh method is work and update data and colomnCollection .
How can i fix this problem.
Thanks all
Onload Method
I wanna refresh my grid when combobox changed.There are data and colomnCollection in onload method, I wanna refresh them when gridRefresh Method is called by combobox select event. data and colomnCollection uses for creating new grid with new data and new columns.
But the problem is, event handler is not work when event change, After all operation in onlad method finish, gridrefresh method is work and update data and colomnCollection .
How can i fix this problem.
Thanks all
Onload Method
protected override void OnLoad(EventArgs e)
{
CssAdder.AddCss("~/Styles/General.css", this.Page);
#region mainpanel
Panel mainPanel = new Panel
{
ID = "mainPanel",
};
#endregion
#region adding child panels to parent panel...
mainPanel.Add(CreateHeader());
mainPanel.Add(CreateSearchPanel());
mainPanel.Add(CreateGrid());
#endregion
this.Add(mainPanel);
}
Create Header Part...
public Panel CreateHeader()
{
Ext.Net.Panel headerPanel = new Ext.Net.Panel
{
Title = "Menu",
ID = "headerPanel"
};
ComboBox cmbMenu = new ComboBox
{
Width = 700,
Value = "UserHistory",
ID = "cmbMenu",
Items = {
new ListItem{
Text="Onaylanmış",
Value="Approved",
},
new ListItem{
Text="Reddedilmiş",
Value="Rejected"
},
new ListItem{
Text="Kullanıcı Geçmişi",
Value="UserHistory",
},
new ListItem{
Text="Onay Bekleyenler",
Value="PendingApprovel"
}
},
Listeners =
{
Select =
{
Handler = " var value=record.data[this.valueField]; State=value; if(value=='UserHistory') {" +
" Ext.getCmp('main_panel').setVisible(true);}" +
"else{ Ext.getCmp('main_panel').setVisible(false);}",
}
}
,
DirectEvents =
{
Select =
{
ExtraParams =
{
new Parameter("cmbMenu","record.data[this.valueField]",ParameterMode.Raw)
}
}
}
};
cmbMenu.DirectEvents.Select.Event += GridRefresh;
headerPanel.Items.Add(cmbMenu);
return headerPanel;
}
GridRefresh Method
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Ext.Net;
using Grid;
/// <summary>
/// Summary description for UserPanelState
/// </summary>
///
namespace UserPanelState
{
public partial class UserPanelState
{
public UserPanelState()
{
}
public void GridRefresh(object sender, DirectEventArgs e)
{
string selectedValue = e.ExtraParams["cmbMenu"];
Ext.Net.Panel gridPnl = new Ext.Net.Panel
{
ID = "grid_panel"
};
if (selectedValue == "Approved")
{
colomnCollection = new Grid.ColumnCollection { "IDID", "Ad", "Soyad", "Telefon", "Firma", "Email", "ToplamSüre" };
data = new List<object>
{
new{IDID="1", Ad="deneme", Soyad="deneme",Telefon="deneme",Firma="deneme",Email="deneme",ToplamSüre="Deneme"},
};
// this.Add(CreateGrid());
}
else
{
colomnCollection = new Grid.ColumnCollection { "ID", "Ad", "Soyad", "Telefon", "Firma", "Email", "ToplamSüre" };
data = new List<object>
{
new{ID="1", Ad="deneme", Soyad="deneme",Telefon="deneme",Firma="deneme",Email="deneme",ToplamSüre="Deneme"},
};
// this.Add(CreateGrid());
}
}
}
}
Last edited by Daniil; Feb 24, 2012 at 12:58 PM.
Reason: [CLOSED]