Asp.net - Can A Page Raise An Event That The User Control Can Handle

Mar 13, 2009

I have done this the other way many times as it makes sense (the page knows about the control as it has been added to the page and can handle the 'child' event)

Is it possible to do it the other way? I think not as the control doesn't know what page it is going to be on

The reason i ask this is that I have a modal popup on the page to ask users to login, and it is only when the user has logged in that I want my user control to go away and execute some code but I am not too sure how to tell the control this has happend?

View 2 Replies


ADVERTISEMENT

Handle The Key Down Event Of The User Control

Dec 19, 2010

I use VB.NET 2010 I have created a user control which holds a few textboxes, where the user can find articles. This user control is added to several Forms (where ever the search is needed). I have to handle the key down event of the user control, but it isn't working... The usercontrols's Key_Down Event is never fired. - I have set KeyPreview of the form to true, then the Key_Down of the Form is fired.

View 6 Replies

.net - Declarative Event Handling From ASP.NET User Control To Page?

Sep 30, 2009

I am trying to figure out how to declaratively pass in a event handler into a user control, but I am stumped. All I can make work is the user control's event handler.. I can't seem to bubble up the caught event into the parent page. Ideas would be quite welcome. Here is my code:Default.aspx:

<%@ Page Language="VB" %>
<%@ Register TagPrefix="rpt" TagName="filter" Src="WebUserControl.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

[Code]...

View 1 Replies

Asp.net Vb User Control Raising An Event On The Calling Page

Apr 7, 2010

i'm trying to learn about user controls. I created a user control that has a textbox and a button. What i'd like to be able to do is when i click the button in the user control, populate a label in the aspx page. I understand that i could just have a button on the page that uses some properties on the user control to get that information.. but i'd like to know how to do it with the button the user control.. the reason for this is the button is just an example.. a learning tool. if i can get this working, i'd likely be putting thing in the user control that might require this kind of passing information. Anyway.. i've found some c# examples that i tried to get working as vb.. but once started getting into the delegates and events..

View 3 Replies

C# - User Control Button Click Event Called Again When Page Is Refreshed Using F5

May 26, 2010

I found that if you press F5 or refress from browser window, the last event fires again
example, I have clicked on a button, the button event is carried out normally, but if I refresh the page by pressing F5 key the same event is fired again.

View 1 Replies

Raise Control DblClick Event?

Jul 5, 2012

I want to raise double click event of sender object. Is it possible to do something like this:

Private Sub MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DG1.MouseDown,DG2.MouseDown, DG3.MouseDown

[Code].....

View 8 Replies

Raise Event In One Class And Handle The Event In Another Class?

Dec 27, 2010

Is it possible to raise event in one class and handle the event in another class? If so, how?

View 6 Replies

Raise Event In One Form And Handle It In Another Form?

Jul 13, 2009

I have two forms, "Customer Information Summary" and "Products Sold". They are shown as separate tabs in a MDI window. When the data in "Products Sold" gets updated, I would like an event to fire from that form which could be handled in the "Customer Information Summary" form.

View 1 Replies

Raise Event Because A User Didn't Not Select A Checkbox Option After Choosing A Certain Value In A Combobox?

Aug 4, 2011

I am new to vb.net and I have looked at other topics. I cannot find the answer I need. OK I have a combobox named cboRaceDesc and five checkboxes (CkRaceAfricanAmerican, ChkRaceAmerican Indian, ckRaceAsian, ckRacePacificIslander, and ckRaceWhite). I was going to post an image, but I cannot.cboRaceDesc has two options...Hispanic and Other. If the user selects Other then they have to choose one of the five checkboxes or it will raise an exception when the record is being saved. I am assuming I would generate the code under the "save" button. I know I need to gather the following information in my code:

If cboRaceDesc.SelectedValue = Other Then
<I am not sure how to code the logic regarding the checkboxes>
<I know I need to use multiple else/else if statements>
<I know towards the end I would generate the exception>
End

Can anyone help me fill in the blanks or point me in the right direction?

View 1 Replies

Use Raise Event To Raise A Programmatically Added Event

Jun 12, 2011

i guess the title pretty much states the question but i will give the senario to be more clear. i have a mousemove() event which i add in my program programmatically and i need a way for raising that event (again) programmatically too. raiseEvent control_mousemove() doesn't work as it says that "'control_MouseDown' is not an event of 'main'."

[Code]...

View 4 Replies

C# - WinForms: Cannot Get ValidateChildren To Raise Validating Event Of A Child Control?

Jul 8, 2010

In a Windows Form application I have a Form with a UserControl that contains a child control. I have an event handler for the child control's Validating event. On the parent UserControl I call the ValidateChildren() method. But the event handler for the child control's Validating event does not run. The CausesValidation property is set to true on both the parent UserControl and the child control. Is there any reason why the Validating event handler would not run?

The child control is a custom control derived from Panel. It contains two RadioButton controls, both of which have their CausesValidation property set to true.

View 1 Replies

Find And Interact With A User Control On Page From Separate User Control?

Oct 17, 2011

I have an aspx page that has two different user controls. I want to find user control A and be able to set properties, etc., from user control B.

I was thinking I could do something like this:

Dim CMFilters As Control = Me.Parent.FindControl("CMFilters")

...but that doesnt work to be able to set properties and call methods. I somehow need to get the user control and and declare it as that user control type.

View 2 Replies

Add An Event Handle To A Custom Control?

Jun 30, 2010

I have a problem to handle an event on a custom control a have on a form.... So first i made a custom control that is just a groupbox with some labels and txtboxes. That control i add dynamically to my form like this (Baycontrol is the name of my control)

Declaration

Code:
Friend Bay(29) As BayControl
Add the controls to Form
Code:
For Simindex = 0 To 29 'Me.Bays - 1

[Code].....

View 5 Replies

Asp.net - Set Master Page On Page Preinit Based On Custom User Control Method Result?

Apr 27, 2011

I have a user control that checks if a certain query string and session value are present then returns a boolean based on that, if it's true I want to set the master page. The page is throwing an Object reference exception when it tries to call the method EditUser1.UserAuthorization(). Why is this happening? I imagine that the method doesn't exist at that point in the stack. Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit

[Code]...

View 1 Replies

User Control - Calling A VB Linkbutton's(within A User Control) Click Event From Javascript?

Apr 11, 2009

how can i call a VB function - deleteevent() in usercontrol.ascx.vb from a javascript function in clickhandler(e) in usercontrol.ascx. The call should cause a postback because I need the usercontrol to display the changes.I am currently trying to do it by using a linkbutton with style display:none, and calling its click event from the javascript function. But i dunno how to call the click event.

View 2 Replies

VS 2008 : Handle The Event Of When The User Checks/unchecks A Checkbox?

Jan 17, 2010

I have a ListView object with the View property set to Details.I also have the CheckBoxes property set to True. Now, how do I get the user's input if they choose to check a box? Right now I am using the ItemCheck event, but that code runs even when I add something to the ListView object.What is the proper way to handle the event of when the user checks/unchecks a checkbox?

View 2 Replies

Access A Page Variable From User Control Placed On That Page From VB?

Dec 27, 2009

I want to access a page variable from a user control placed on that page. All the solutions work in C# via casting to the page class. The problem is that this doesn't work in VB. The page class is not selectable from the Intellisense dialog. Manual typing results in the error type not defined. It is strange that C# can do this without a problem. What is the proper solution for this in VB? I had other cases where I needed to access a control on the main page. C# again uses a cast to the page class to access the control. This doesn't work in VB again. So how can I access the page class from a user control in generell?

View 5 Replies

Handle Browser Popups Using The NewWindow Event Of The WebBrowser Control

Oct 21, 2010

I'm trying to handle browser popups using the NewWindow event of the WebBrowser control. The one main thing I needed is the cookie from the main browser control on my form to be passed to the popup window. Below is the only way I've been able to open the popup and pass the Document.Window.Opener value to it so that when java script is executed, it knows where the opener window is. I am getting the following error right now when trying to set the cookie from my webbrowser control to the iexplore instance of the popup window that opened.

[Code]...

View 1 Replies

Handle Events On The Dynamically Loaded User Control?

Jun 20, 2011

I have the user control that is loaded dynamically. When the user save the data by clicking on the Save button, a raise event is passed.

Public Sub RaiseCloseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
RaiseEvent Close(sender, e)
Debug.Print(String.Format("The control {{0}} was closed by {{1}}.", Me.Name, sender.ToString))
End Sub

In the save button I have called the RaiseCloseEvent as follows:

RaiseCloseEvent(sender, e)

Now, how can I close the user control form? Any Idea? I have used VB.Net language.

View 2 Replies

VS 2008 Raise Event Of "Win. Form Control" From Form Outside The Control

Oct 13, 2011

I have created simple windows form control with some events.

This form has button which opens Form with some settings.

Now, I need to raise the events inside the control when I click some buttons within the settings form ..

View 5 Replies

Raise Event - Put An Extra Event In - UpdateID And It's Not Firing

Aug 9, 2011

I am trying to put an extra event in, UpdateID and it's not firing.

[Code]...

View 1 Replies

Asp.net - Adding To Page Control Collection From Inside A User Control?

Feb 12, 2011

I have an asp.net usercontrol which represents a "popup" dialog. Basically, it's a wrapper for the jQuery UI dialog which can be subclassed to easily make dialogs. As part of this control, I need to inject a div into the page the control is used on, either at the very top or very bottom of the form so that when the popup is instantiated, it's parent is changed to this div. This allows "nested" popups without the child popup being trapped inside the parent popup.

The trouble is, I can't find a safe way to inject this div into the page. A usercontrol doesn't have a preinit event, so I can't do it there, and calling Page.Form.Controls.Add(...) in Init, Load or PreRender causes the standard exception "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases."

I thought I had found a solution by using. ScriptManager.RegisterClientScriptBlock(Page, Me.GetType, UniqueID + "_Dialog_Div", containerDiv, False) which seemed to work well normally, but recently a coworker tried putting an UpdatePanel inside the dialog and now she's getting the error "The script tag registered for type 'ASP.controls_order_viewzips_ascx' and key 'ctl00$ContentBody$OViewZips_Dialog_Div' has invalid characters outside of the script tags: . Only properly formatted script tags can be registered."

How are you supposed to add controls to the pages control collection from inside a user control?

View 2 Replies

VS 2008 Handle Saving User Control Settings On Form Close?

Dec 27, 2009

What is the correct way to handle saving user control settings on form close. I have a tabcontrol that a user can add tabpages during runtime. The user control has a few controls (listbox,combobox,textbox) How can I save the created tabpages and the data in each control in the usercontrol? Below is how I am calling my usercontrol

Code
Public Class TabPageEx
Inherits System.Windows.Forms.TabPage

[code]....

I seem to be a little lost as most documentation seems to suggest that I can not save usercontrol settings in the app.config. I have played around with the solution expl. settings tab without much success. But, then again I may be going about it all wrong. So, I am looking for a little direction on the best way to handle this on form close.

View 4 Replies

Industrial App: Raise An Event For Something That Doesn't Have An Event?

Sep 15, 2010

I want to raise an event for an opto-input state change but not sure if I can. Basically I have 4 opto-inputs on a PCI control card - one of which changes pretty rapidly - that I currently poll with a timer. I'm looking at getting a proper hardware counter for that but the other 3 are production status indicators. I'd prefer it if they alerted the app to a state change though.

Depending on the state of one of the inputs I have to fire a relay which simulates a button push. Having been playing with serial ports and getting a very useful app built for logging production data into a SQL Server DB I want to re-visit a proof-of-concept system I built a few months ago.

Current code - which works fine - but I'd like to change is like this:

Private Sub tmrOptoInput_0_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrOptoInput_0.Tick
'Read OptoInput_1 to Monitor Track State...
Dim aType As Byte ' replace Byte with any other type

[code].....

Having 4 inputs so I need 4 timers, plus another one that polls the database and checks a status flag which triggers the app to start logging. I'd like it to be event driven rather than timer driven if at all possible but I don't know how and there's nothing in the control card docs. Also I can't seem to find anything relevant on the web.

View 2 Replies

One Trigger A Click Event In A UserControl From The Main Form's Tab Index Control That Contains An Instance Of The User Control?

Jan 5, 2011

The code is listed below which hopefully illustrates what I'm trying to do:[code]....

View 12 Replies

Asp.net - Handle Master Page Button Click Events In The Content Page?

Jul 2, 2011

I have master page in ASP.NET. I have added two asp controls to master page i.e. _EmpDROPDOWN and _findBUTTON.I have one content page. FindEmployee.aspx which shows result list of employees (Gridview) based on the selection made in _EmpDROPDOWN when _FindBUTTON is clicked on Master Page.I dont know how to read Master Page button click evenet in Content page.How to read master page button click event (VB.NET syntax) in Content Page?

View 1 Replies

ItemCommand Event Of FormView Control Not Firing/working In ASP.Net Page

Jun 5, 2009

ItemCommand Event of FormView control not firing/working in ASP.Net Page

View 1 Replies

How To Raise Event In Vb Asp.net 2.0 ?

Sep 14, 2010

How to raise event in vb asp.net 2.0 ?

View 2 Replies

Raise Event After All Others Done?

Apr 8, 2010

Is it possible to run a sub routine on my form after all other sub routines have finished? I am having a problem using a filewatcher that watches a certain path and runs an SQL job if a certain file is pasted. For some reason my procedure leaves a file behind sometimes and others it does not. I was wondering can I use a form event to run a different procedure after all other sub routines on the form are completed that would check this directory for remaining files again?

View 1 Replies

C# - Using A User Control In A Base Page Class

May 21, 2009

I have a base page class that inherits from Page. We'll call it SpiffyPage. I also have a user control called SpiffyControl. I then have an aspx page, ViewSpiffyStuff.aspx, that inherits from SpiffyPage. On page load, the SpiffyPage class is supposed to inject a SpiffyControl into the aspx page. The problem is that SpiffyControl is a user control, and to instantiate that in the code behind one has to access the ASP namespace, sort of like: ASP.controls_spiffycontrol_aspx MyControl;

But SpiffyPage isn't an aspx page, it's just a base page, and as such I can't access the ASP namespace, and I therefore can't instantiate a SpiffyControl in order to inject it. How can I achieve my goal?

Edit: One important point is that I must have a reference to the actual control type so I can assign values to certain custom Properties. That's why a function like LoadControl, which returns type Control, won't work in this case.

View 11 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved