User Control calling another function in another user control

by rBellantoni 8/24/2009 11:31:00 AM

Recently I faced an issue where I had two user controls. Inside one of the controls I needed to call a load function from the other control that are both in the same aspx page. So to do this I wired up a new handler in the page load event of the main aspx page. The page that contains both user controls like so:

 this.UserControl.OnAddNewButtonClicked += new Controls_UserControl.AddNewButtonClicked(AddNewButtonClicked);

Then I created the function for this to attach to:

 public void AddNewButtonClicked(object sender, EventArgs e)

 

}

Inside the control that we are doing the calling from we create the delegate and the event:

public partial class Controls_UserControl : System.Web.UI.UserControl

{

     public delegate void AddNewButtonClicked(object sender, EventArgs e);

     public event AddNewButtonClicked OnAddNewButtonClicked;

}

Now inside of the event that we would like to fire the function from the other usercontrol we reference the delegate:

public void btnAddNew_Click(object sender, EventArgs e)

{

     try

     {

          // Save the form

         SaveForm();

         pnlMessage.Visible =
true;         if (OnAddNewButtonClicked != null)

         { 

              OnAddNewButtonClicked(sender, e);

         }

     }

     catch (Exception ex)

     {

          HandleError(ex);

     }

}

Now inside of the function we created earlier in the main aspx page, we can call whatever usercontrol.function we would like to fire:

public void AddNewButtonClicked(object sender, EventArgs e)

{

     LoadControls();

}

Tags:

What does Bounce Rate Mean?

by ebarcza 8/24/2009 11:21:00 AM

What does Bounce Rate mean?

As defined by Google:

Bounce rate is the percentage of single-page visits or visits in which the person left your site from the entrance (landing) page. Use this metric to measure visit quality - a high bounce rate generally indicates that site entrance pages aren't relevant to your visitors. The more compelling your landing pages, the more visitors will stay on your site and convert. You can minimize bounce rates by tailoring landing pages to each keyword and ad that you run. Landing pages should provide the information and services that were promised in the ad copy.

Tags:

Setting Session Timeouts in ASP Classic and ASP.NET

by ebarcza 8/21/2009 5:45:00 AM

First the Classic

I set this in my login script or alternativwly can be set in the Global.asa in the Session_OnStart Event 

Session.Timeout = 120 -- 120 being the number of minutes.

sub Session_OnStart

'120 minutes

Session.Timeout = 120

end sub

Now ASP.NET

Via Web Config

<sessionState timeout="60" />

Tags: , ,

.NET

Colspan in RDLC

by rBellantoni 8/6/2009 11:13:00 AM
There is no colspan in an RDLC, however you can merge cells, especially useful for long headers in the group by section. You can highlight the cells you want to merge and right click and merge them. Essentially performing the same as a colspan.

Tags:

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  July 2017  >>
MoTuWeThFrSaSu
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

View posts in large calendar

Recent comments

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Sign in