H
Hrvoje Voda
I'm using this code to check click event on usercontrol.
But I get an error:
User ControlGridFilter)
public delegate void FilterText(string filterText);
public event FilterText textFilter;
private void buttonTrazi_Click(object sender, EventArgs e)
{
if (textFilter != null)
textFilter(txtFilter.Text);
}
Main form:
private void Main_Load(object sender, EventArgs e)
{
GridFilter.textFilter += new Utils.GridFilter.FilterText(gridFilter);
}
protected void gridFilter(string filter)
{
string tree = treeKolekcija.SelectedNode.Text;
switch (tree)
{
case "Akcioni":
DataRow[] afrows = db.dataSetKolekcija.Akcioni.Select("Naziv LIKE '" +
filter + "%'" );
DataTable newtable = new DataTable();
int c = 0;
foreach (object o in afrows[0].ItemArray)
{
newtable.Columns.Add(new DataColumn(string.Format("col{0}", c++),
o.GetType()));
}
foreach (DataRow dr in afrows)
{
newtable.Rows.Add(dr.ItemArray);
}
gridData.Grid.DataSource = newtable;
break;
}
}
But I get an error:
User ControlGridFilter)
public delegate void FilterText(string filterText);
public event FilterText textFilter;
private void buttonTrazi_Click(object sender, EventArgs e)
{
if (textFilter != null)
textFilter(txtFilter.Text);
}
Main form:
private void Main_Load(object sender, EventArgs e)
{
GridFilter.textFilter += new Utils.GridFilter.FilterText(gridFilter);
}
protected void gridFilter(string filter)
{
string tree = treeKolekcija.SelectedNode.Text;
switch (tree)
{
case "Akcioni":
DataRow[] afrows = db.dataSetKolekcija.Akcioni.Select("Naziv LIKE '" +
filter + "%'" );
DataTable newtable = new DataTable();
int c = 0;
foreach (object o in afrows[0].ItemArray)
{
newtable.Columns.Add(new DataColumn(string.Format("col{0}", c++),
o.GetType()));
}
foreach (DataRow dr in afrows)
{
newtable.Rows.Add(dr.ItemArray);
}
gridData.Grid.DataSource = newtable;
break;
}
}