I'm using this code to check click event on usercontrol.
But I get an error:
User Control:(GridFi lter)
public delegate void FilterText(stri ng filterText);
public event FilterText textFilter;
private void buttonTrazi_Cli ck(object sender, EventArgs e)
{
if (textFilter != null)
textFilter(txtF ilter.Text);
}
Main form:
private void Main_Load(objec t sender, EventArgs e)
{
GridFilter.text Filter += new Utils.GridFilte r.FilterText(gr idFilter);
}
protected void gridFilter(stri ng filter)
{
string tree = treeKolekcija.S electedNode.Tex t;
switch (tree)
{
case "Akcioni":
DataRow[] afrows = db.dataSetKolek cija.Akcioni.Se lect("Naziv LIKE '" +
filter + "%'" );
DataTable newtable = new DataTable();
int c = 0;
foreach (object o in afrows[0].ItemArray)
{
newtable.Column s.Add(new DataColumn(stri ng.Format("col{ 0}", c++),
o.GetType()));
}
foreach (DataRow dr in afrows)
{
newtable.Rows.A dd(dr.ItemArray );
}
gridData.Grid.D ataSource = newtable;
break;
}
} 7 3065
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*********@lu atech.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:(GridFi lter)
public delegate void FilterText(stri ng filterText);
public event FilterText textFilter;
private void buttonTrazi_Cli ck(object sender, EventArgs e)
{
if (textFilter != null)
textFilter(txtF ilter.Text);
}
Main form:
private void Main_Load(objec t sender, EventArgs e)
{
GridFilter.text Filter += new Utils.GridFilte r.FilterText(gr idFilter);
}
protected void gridFilter(stri ng filter)
{
string tree = treeKolekcija.S electedNode.Tex t;
switch (tree)
{
case "Akcioni":
DataRow[] afrows = db.dataSetKolek cija.Akcioni.Se lect("Naziv LIKE '" +
filter + "%'" );
DataTable newtable = new DataTable();
int c = 0;
foreach (object o in afrows[0].ItemArray)
{
newtable.Column s.Add(new DataColumn(stri ng.Format("col{ 0}", c++),
o.GetType()));
}
foreach (DataRow dr in afrows)
{
newtable.Rows.A dd(dr.ItemArray );
}
gridData.Grid.D ataSource = newtable;
break;
}
}
I don't understand.
I have an event textFilter that I check in button_click event.
"Kevin Spencer" <un**********@n othinks.comwrot e in message
news:%2******** ********@TK2MSF TNGP06.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*********@lu atech.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:(GridFi lter) public delegate void FilterText(stri ng filterText);
public event FilterText textFilter; private void buttonTrazi_Cli ck(object sender, EventArgs e)
{
if (textFilter != null)
textFilter(txt Filter.Text);
}
Main form:
private void Main_Load(objec t sender, EventArgs e)
{
GridFilter.tex tFilter += new Utils.GridFilte r.FilterText(gr idFilter);
}
protected void gridFilter(stri ng filter)
{
string tree = treeKolekcija.S electedNode.Tex t;
switch (tree)
{
case "Akcioni":
DataRow[] afrows = db.dataSetKolek cija.Akcioni.Se lect("Naziv LIKE '" + filter + "%'" );
DataTable newtable = new DataTable();
int c = 0;
foreach (object o in afrows[0].ItemArray)
{
newtable.Colum ns.Add(new DataColumn(stri ng.Format("col{ 0}", c++), o.GetType()) );
}
foreach (DataRow dr in afrows)
{
newtable.Rows. Add(dr.ItemArra y);
}
gridData.Grid. DataSource = newtable;
break;
}
}
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.Cli ck += new EventHandler(bu ttonTrazi_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*********@lu atech.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**********@n othinks.comwrot e in message
news:%2******** ********@TK2MSF TNGP06.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*********@lu atech.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:(GridFi lter) public delegate void FilterText(stri ng filterText);
public event FilterText textFilter; private void buttonTrazi_Cli ck(object sender, EventArgs e)
{
if (textFilter != null)
textFilter(tx tFilter.Text);
}
Main form:
private void Main_Load(objec t sender, EventArgs e)
{
GridFilter.te xtFilter += new Utils.GridFilte r.FilterText(gr idFilter);
}
protected void gridFilter(stri ng filter)
{
string tree = treeKolekcija.S electedNode.Tex t;
switch (tree)
{
case "Akcioni":
DataRow[] afrows = db.dataSetKolek cija.Akcioni.Se lect("Naziv LIKE '" + filter + "%'" );
DataTable newtable = new DataTable();
int c = 0;
foreach (object o in afrows[0].ItemArray)
{
newtable.Colu mns.Add(new DataColumn(stri ng.Format("col{ 0}", c++), o.GetType())) ;
}
foreach (DataRow dr in afrows)
{
newtable.Rows .Add(dr.ItemArr ay);
}
gridData.Grid .DataSource = newtable;
break;
}
}
On Wed, 18 Apr 2007 03:12:41 -0700, Hrvoje Voda <hr*********@lu atech.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?
I get an error on main form.
error : An object reference is required for the nonstatic field, method, or
property 'Utils.GridFilt er.textFilter'
"Peter Duniho" <Np*********@nn owslpianmk.comw rote in message
news:op******** *******@petes-computer.local. ..
On Wed, 18 Apr 2007 03:12:41 -0700, Hrvoje Voda <hr*********@lu atech.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?
On Wed, 18 Apr 2007 13:10:31 -0700, Hrvoje <hr**********@z g.htnet.hr>
wrote:
I get an error on main form.
error : An object reference is required for the nonstatic field, method,
or property 'Utils.GridFilt er.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.GridFilt er.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
it worked fine on another control.
Now, I put it on a different control and it doesn't work.
"Peter Duniho" <Np*********@nn owslpianmk.comw rote in message
news:op******** *******@petes-computer.local. ..
On Wed, 18 Apr 2007 13:10:31 -0700, Hrvoje <hr**********@z g.htnet.hr>
wrote:
>I get an error on main form.
error : An object reference is required for the nonstatic field, method, or property 'Utils.GridFilt er.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.GridFilt er.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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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" Src="WebControls/Header.ascx"
%>
The web user control contains the following server controls
|
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 dropdown in UC1
_________________________
1) MainPage_Load
2) User Control_1 Load
|
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 the usual stuff of
recreating the usercontrol in the Page Init event.
The 'failure' sequence is as follows:
- select web form button to display...
|
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 I have
exposed a public property containing the value of a textbox in a user
control..how do I grab this from the calling page? I cant think of the...
|
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 like this is a bug or that .NET doesn't
support what I
trying to do.
I hope that one that is is microsoft certified read this because this must
be a...
| |
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 way I'm going
about doing this might be a little off. I'd appreciate some help.
Below is the code I have thus far but I'm not sure how to...
|
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 will do some
database updates, then I will use reflection to call a method in the
parent (this.page) to load the new user control. Its at this...
|
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 required:
<%@ Register TagPrefix="UC" TagName="MyUserCtrl" Src="MyUC.ascx" %>
Assuming that the ASPX page doesn't use a code-behind, I can access the...
|
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 been able to find the cause of the problem, and will describe it here first textually and then through a code example.
The purpose of what I am...
|
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 been unable to expose the
user control class itself. I'm guessing that I need to set up an interface,
but I am not sure how to accomplish this.
...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |