I have an ASP webpage with a usercontrol. In the usercontrol is a number (int) that I would like to send to a nother class outside the usercontrol. Well just wondering how in *beeb* dos one do that.
Some code would be helpfull
Well hoping for all the help in da world :D
P.S. using visual studios 2005

ASP usercontrol with C#
smcneese
You can use a delegate. A delegate is like an event, except that you can define t he function signature
delegate void MyFunc(int i);
public MyFunc Callback = null;
Then in the code that finds the int
if (Callback != null) Callback(myInt);
Then you hook this up like any other delegate
in your other class
void myDelegateHandler(int i)
{
// whatever
}
myUserControl.Callback += new MyUserControlType.MyFunc(this.myDelegateHandler);
www.asp.net is the right place for future ASP.NET questions.
Michael Horne
sorry the varibals are in icelantic. Well you get the point I would thingk
private void RenderShoppingChart()
{
ArrayList list = Session["vorur"] as ArrayList;
if (list != null)
{
BulletedList1.Items.Clear();
foreach (Vorur v in list)
{
samtals += v.VorurVerd;
string s = string.Format("{0} - {1}", v.VorurStaerd, v.VorurNafn);
BulletedList1.Items.Add(new ListItem(s));
}
lblMatsedillSamtals.Text = string.Format("Samtals {0} kr", samtals);
}
}
Basicily what is happening in the big picture that I am adding a product to a list and showing the total price with "samtals"
On a ASP webpage there is a butten and wen I push it I should get the number contained in "samtals"
I just don't get were I should put the code that you posted
By the way total newbe dooing a first year asighnment and sorry if there are any spelling mistakes