Vb.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.. well.. it made me turn to this post.

View 3 Replies

Similar Messages:

Raising An Event Inside A User Control That Returns CommandEventArgs?

Dec 5, 2010

i have the following problam:i have a user control which i want to raise an event from to the page that is using that user control (its a button)anyway my problem started when i wanted to put this user control inside a repeater instead of another button (regular asp:button) anyway i needed to support CommandArgument so that page can use the buttonso i created a property:

Private m_CommandArgument As Object
Public Property CommandArgument() As Object


View 1 Replies

Web Forms :: Accessing Master Page From Content Page - Raising Event?

Sep 10, 2010

Here is my situation: I have a user control that has a menu in it. This user control sits on my master page. It is my main navigation menu for my application. I am having an issue where, on one of my pages, users seem to be leaving the page before committing all changes to the database, which results in a loss of data. So what I want to accomplish is - if the user is leaving this page and the data has not been saved yet, I want to prompt the user and say something like "The information is not yet saved, are you sure you want to leave this page" in a modal popup. So my approach is this: In my menu user control, create an event handler called MenuClicked that is raised when the menu web control's (in the user control) MenuItemClicked is raised, I raise my custom MenuClicked event. Then on my master page, I can catch this event in NavMenu_MenuClicked. My problem is - I need to catch this event in my content page, not the master? Am I approaching this correctly?

View 2 Replies

C# - Calling A Method On The Parent Page From A User Control?

May 3, 2010

I am using a user control that I created (just a .cs file not an .ascx file), that does some magic and depending on a value generated by the control, I need it to do something on the parent page that is 'hosting' the control. It needs to call a method under certain circumstances (method is on the parent control).the control is placed on the parent page like so:

<customtag:MyControl ID="something" runat="server" />

I'm dynamically creating buttons etc on the control itself but when a button is clicked, let's say for example that there's a text box on the control and if the value of the textbox is "bob" it needs to call a method on the page that's housing the control...how can I accomplish this?

View 3 Replies

Web Forms :: Calling Master Page Method From A User Control?

Apr 5, 2010

Does anyone know how I would go about calling a method found in the master page code behind from a user control's code? The user control is on the master page. The method I want to call is public.

I can easily call a method found in the pages code behind using:

Page.GetType().InvokeMember("TheMethodsName", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, null);

or I can call a method found on the master page from my aspx page code behind using:


But I am stuck because I can't find the MasterPage in my user control code behind.

View 4 Replies

Web Forms :: Calling A Page Method Using InvokeMethod From An User Control?

Jan 18, 2011

I have an aspx page which has an usercontrol say UC1 for selecting query paramters.

UserControl uc1 in turn opens another user control (UC2) as a modal popup.

1. On OK click, I am setting the values of another usercontrol (uc1) from the control uc2 by invoking a page method(doAccept). It appears to call the method and values seems to be set. But the problem the usercontrol/page does not display the new value or in otherwords it is not refreshed.

If the above is not possible is there any other way to refresh the parent page.


View 3 Replies

AJAX :: Calling Parent Page Method From User Control?

Oct 3, 2010

I looked up the threads about this. But I couldn't do it...

this is my method in aspx.page:

public void MesajlariGetir()
DataSet ds = new DataSet();
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand("msjlarigetir", con);


View 4 Replies

Web Forms :: Calling Controls In A Page From A User Control File (.ascx)?

Nov 5, 2010

I have a page called main.apsx and on that page I have a multiview with a couple of view panes. In main.aspx I also have an have a buttons.ascx file with a few link buttons. When these buttons are clicked I want them to show the the selected view panels in multiview in main.aspx.

I cant seem to figure out where to put the action code for the link buttons. Do I put it into my buttons.ascx.cs file or into main.aspx.cs? I presume in buttons.ascx.cs, but if I do that, how will the buttons find the multiview control?

This is the code for on of my buttons in buttons.ascx.cs


When I run it like this is gives an error

The name 'MultiView1' does not exist in the current

The name 'View1' does not exist in the current

View 2 Replies

Web Forms :: Add Event Handler To User Control And Capture Event On Parent Page?

Apr 24, 2010

Using vb.net/asp.net 2005.

I have a page books.aspx that has a control named authors.ascx.

Inside the authors control there is a "select" button I want to add some kind of listener or event handler (not sure of the correct terminology) so on the parent page (books.aspx) I can respond to the "select" button being clicked.

I have to pass the authorID from the user control to the parent page.

In my authors.ascx control I just created this event:


Now I need to write the function for SelectAuthorBtnClick and I think add some kind of listener in the parent page to listen and handle the event.

View 7 Replies

Forms Data Controls :: Calling User Defined Grid Control Two Time's On A Page?

Mar 11, 2011

i created a user control and place a button on it.i drag dropped the user control on a aspx page and wrote the grid load and button clicks in the

user control.now i got a requirement to use the same user control grid and button to again use on the same page.however the data populated will be different and the button click functionality will be different.how can i reload the different data on the second grid as i had already wrote the code in the first one

View 2 Replies

AJAX :: Calling Server Side Events For A User Control Loaded In Update Panel - Refresh Page

May 23, 2010

I need to update datalist in image gallery when fileupload has been completed.

<div style="display: block;">
<div style="padding-left: 15px; padding-right: 15px;">
<uc1:ctrlFileUpload ID="ctrlFileUpload1" runat="server" />
<uc2:ctrlImageGallery ID="ctrlImageGallery1" runat="server" />

In the Control File Upload I need to fire the the other ctrl to refresh the page.

<asp:UpdatePanel ID="UpdatePanelUploadArea" runat="server" UpdateMode="Conditional">
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<asp:Button ID="UploadButton" runat="server" Text="Upload Now" OnClick="UploadButton_Click" />
<asp:Label ID="lblResult" runat="server" ForeColor="#0066FF"></asp:Label>
<br />
<asp:PostBackTrigger ControlID="UploadButton" />

View 25 Replies

C# - Button In Repeater Not Raising Event?

Aug 18, 2010

When I work with the tab Ajax control, and in one tab, I have a Repeater: <asp:Repeater runat="server" ID="rp1" onitemcommand="rp1_ItemCommand"> and in protected void rp1_ItemCommand(object source, RepeaterCommandEventArgs e) method, I add a button and it's event:

Button btn = new Button();
btn.Text = "Update";
btn.Click += new EventHandler(btn_Click);
void btn_Click(object sender, EventArgs e)

However, when I click on the update button, the event is not raised.

View 1 Replies

Why Custom Event Handler Raising Two Times

Jan 14, 2010

i have created a custom event and assigned a handler to it .

the line which raises event is called one time but handler is getting called TWO times , why it is so ?

View 2 Replies

C# - Raising The Load Event Within A Dynamic Loaded Web Usercontrol?

Jan 19, 2011

I need to load a web user control dynamically.

Looking at [URL] it states that the page lifecycle events are not fired.

I thought I might be able to raise the events through reflection. I cannot figure how to fire the events, am I missing something?

View 2 Replies

AJAX :: Raising A Server-Side Event While Typing In A TextBox?

May 24, 2010

I have a TextBox as bellow:


How can I raise a server-side event while I'm typing in it?

View 11 Replies

Raising Custom Event - Cannot Access WebErrorEvent Due Its Protection Level

Apr 29, 2010

I use SqlWebEventProvider to log the exceptions to sql server, and it works fine.

I also want to log custom exceptions to aspnet_WebEvent_Events table programmatically. Similar to - [URL]

WebBaseEvent.Raise(new WebErrorEvent("My Error message", null, 5000, e)); I get an error saying "Cannot access constructor 'WebErrorEvent' here due its protection level.

View 2 Replies

Forms Data Controls :: Edit Button Not Raising Event In Datagrid?

Jun 29, 2010

I am using Datagrid.onclick of edit i need to raise a event and capture the empid in the method.How to proceed

<asp:DataGrid Runat="server" ID="gridProduct" AllowPaging="True">
<asp:TemplateColumn HeaderText="Employee Name">


View 3 Replies

Web Forms :: User Control - Run Before Page Load Event?

Mar 3, 2010

I have a user control that will basically be a header in most of my pages, but not all. I want some code in the user control to be run before the page load event of the page that holds the user control, but the page load event fires before the events in my user control. Is there a way around this?

View 3 Replies

C# - Attach User Control's Event In Content Page?

Apr 3, 2011

I have a form in user control which submits data in database and clicking button. how to attach this button press even directly in the aspx page. I do not want to make delegate and want to use default event.

View 1 Replies

Web Forms :: Access Page Load Event From User Control

Mar 2, 2010

I have a page called "EDIT.ASPX" on that page it has come TextBoxes, Label and 3 User Controls. When the Edit.aspx page is loaded all the correction form Controls are loaded properly, even the User Controls loads with no problem. The problem that I am expericing is that on the User Control I have a CHECKBOX with AutoPostBack="true". Each time the user click the CheckBox the User Control disappear. NOTE: How do I fix this problem and eliminate my page control from vanshing. The user control needs to keep the same state as the Edit.aspx page when the checkbox is clicked. I need to be able to click the checkbox without loosing any data on the page rather it's the Edit Page or the User Control.

View 5 Replies

Raise ItemDataBound Event From Repeater Within User Control To Page?

May 20, 2010

I have a user control that contains a repeater. We have added some paging and sorting into the user control and it all works well.

What I need now is a nice way to catch the OnItemDataBound event of the inner repeater and then bubble it up to be accessible directly from the user control from within the page.

We have tried catching it and then declaring it in the user control but it just won't work.

View 2 Replies

C# - Call An Event Handler In A User Control From Host Page

Dec 9, 2010

I have a dropdownlist in a user control and i want to perform different functions on the basis of the host page that hosts this user control when the selected index of the dropdownlist changes e.g. when the host page is locations i want the event to load locations for the selected item in the dropdown, when the hosting page is services i want to load services for the selected item in the dropdown. What is the best possible way to achieve this scenario.

View 2 Replies

Web Forms :: User Control Needs To Fire Event In Aspx Page?

Jan 31, 2010

I have a need to improve the asthetics of the standard buttons .net churns out. I am fully aware of how to do this using css but I can only really style the button if I add a span element inside the button. Luckily the link button allows this so I have got the following which for usability i have put inside a user control.

<linkbutton><label>button text</label></linkbutton>

I have exposed elements so that I can set values from within my aspx.cs page, these are text, command name, command argument, ccc class etc.

As it is a generic control, I have added OnCommand='Button_Click" which fires the event in the control itself. The Button_Click event calls a method ButtonControls passing associated command name and arguments across. ButtonControls uses the name to call the appropriate function.

As these are all very generic buttons, so far so good, but I have a need to trigger button events that may not be generic i.e on a control I have buttons that do something very specific to that control. I also have a requirement to call functions which relate to specific controls on the aspx page. I have created a user control which encapsulates the link button control.

Click triggers > Button_Click > ButtonControls > MethodToCall

sometimes I don't want to call Button_Click just an event on the aspx page itself rather than my generic button handler.

View 5 Replies

C# - Handling MasterPage Event In User Control Of Content Page?

Aug 23, 2010

On my master page , I have "Search textbox" and "Search Button".On My content page , I have a "User Control" which has a "GridView".It shows some data about Vendors.Also, on this User Control's Page Load, i have code written to display all vendors in GridView.Now, when user enters Vendor Number in "Search textbox" , and hits "Search Button" , i want to handle this event inside my User Control.How to do this ?

View 2 Replies

Web Forms :: Event Fire In User Control - Consumed By Parent Page

May 13, 2010

I have a 2 part question for web user controls: 1. I want to have an event fire in my user control, but have it be consumed by the parent page, like:

<asp1:Object id="objectMain" runat="server" OnClick="Click" />

Is it possible to do this? Or do I need to make a server control for this functionality? I have it being able to be set in the Page_Init, but I'd like to make it as similar to actual controls as possible. Also, if it is possible to access via the Events section under Properties, that would be good and 2. I am trying to register the web user control as an AsyncPostbackTrigger for another UpdatePanel. With the previous question in mind, is it also possible to set this via the GUI, or does this need to be set programmatically as well?

View 1 Replies

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