473,509 Members | 2,890 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

user control

I'm using this code to check click event on usercontrol.
But I get an error:
User Control:(GridFilter)
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;

}

}
Apr 18 '07 #1
7 3045
You haven't assigned the Button Click event handler to the handler method
you created.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Hrvoje Voda" <hr*********@luatech.comwrote in message
news:f0**********@ss408.t-com.hr...
I'm using this code to check click event on usercontrol.
But I get an error:
User Control:(GridFilter)
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;

}

}


Apr 18 '07 #2
I don't understand.
I have an event textFilter that I check in button_click event.

"Kevin Spencer" <un**********@nothinks.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
You haven't assigned the Button Click event handler to the handler method
you created.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Hrvoje Voda" <hr*********@luatech.comwrote in message
news:f0**********@ss408.t-com.hr...
>I'm using this code to check click event on usercontrol.
But I get an error:
User Control:(GridFilter)
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;

}

}



Apr 18 '07 #3
You created a Button click event Handler method, but you didn't assign it to
the Button's Click event. You need to do something like the following:

buttonTrazi.Click += new EventHandler(buttonTrazi_Click);

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Hrvoje Voda" <hr*********@luatech.comwrote in message
news:f0**********@ss408.t-com.hr...
>I don't understand.
I have an event textFilter that I check in button_click event.

"Kevin Spencer" <un**********@nothinks.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>You haven't assigned the Button Click event handler to the handler method
you created.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Hrvoje Voda" <hr*********@luatech.comwrote in message
news:f0**********@ss408.t-com.hr...
>>I'm using this code to check click event on usercontrol.
But I get an error:
User Control:(GridFilter)
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;

}

}




Apr 18 '07 #4
On Wed, 18 Apr 2007 03:12:41 -0700, Hrvoje Voda <hr*********@luatech.com>
wrote:
I'm using this code to check click event on usercontrol.
But I get an error:
What error do you get? Where does the error happen?
Apr 18 '07 #5
I get an error on main form.

error : An object reference is required for the nonstatic field, method, or
property 'Utils.GridFilter.textFilter'
"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Wed, 18 Apr 2007 03:12:41 -0700, Hrvoje Voda <hr*********@luatech.com>
wrote:
>I'm using this code to check click event on usercontrol.
But I get an error:

What error do you get? Where does the error happen?

Apr 18 '07 #6
On Wed, 18 Apr 2007 13:10:31 -0700, Hrvoje <hr**********@zg.htnet.hr>
wrote:
I get an error on main form.

error : An object reference is required for the nonstatic field, method,
or property 'Utils.GridFilter.textFilter'
"On main form" is not very useful information. Where specifically does
your error happen? What causes it to happen?

Not that you should at this point really need our help. It seems to me
that the error is pretty self-explanatory. Somewhere you are using
"Utils.GridFilter.textFilter" and it requires an object reference even
though you are not providing one. You should be able to figure that one
out. If not, you really need to provide actual information that describes
the context of the error for us.

Pete
Apr 18 '07 #7
it worked fine on another control.
Now, I put it on a different control and it doesn't work.
"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Wed, 18 Apr 2007 13:10:31 -0700, Hrvoje <hr**********@zg.htnet.hr>
wrote:
>I get an error on main form.

error : An object reference is required for the nonstatic field, method,
or property 'Utils.GridFilter.textFilter'

"On main form" is not very useful information. Where specifically does
your error happen? What causes it to happen?

Not that you should at this point really need our help. It seems to me
that the error is pretty self-explanatory. Somewhere you are using
"Utils.GridFilter.textFilter" and it requires an object reference even
though you are not providing one. You should be able to figure that one
out. If not, you really need to provide actual information that describes
the context of the error for us.

Pete

Apr 19 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
11268
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
1
7536
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
6
3350
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
4
2493
by: louise raisbeck | last post by:
Resending this as own topic as didnt get answer from original. Would be grateful for a response from anyone that knows. Thanks. Hi there, I found your post really helpful..but i wondered if, once...
0
3915
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something...
8
3006
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
0
3394
by: davidr | last post by:
Hi, I have a panel that I load user Control in no problem. The problem arrises when I do a post back on one of these user controls. I have button it does a click event. In this click event I...
2
4804
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
2
15044
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
3
1916
by: Fred Chateau | last post by:
I am trying to access a user control class, for a user control that is loaded dynamically, from the containing page. I have been able to access Web controls in the user control, but so far I have...
0
7344
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7412
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5652
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5060
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4730
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3216
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.