How to call C#.net function in one usercontrol from another user control
hi everybody
i have one function like
bindcs()
{
}
in my one user control.
now i want to call this function from my another user control.
i tried to do this by findcontrol but it get the whole control i dont get it its function.
can anyone help me?
thanks
shwetaThanksshwetaIn a day when don't come across any problem -you can be sure that you are traveling in wrong path
You will need to declare the method as public and then cast the control that you get from FindControl to be the type of the user control.
A good approach for this is to implement an event on t...
How to call a function from one User Control from another User Control
Hi,
I have one User Control in a page, the User Control has a button, when the user clicks on the button, I need to call a function within another User Control (on the same page). I have made a function public, but I don't know see the function from the other User Control.
Can you help me please,
Thank you!
Aldo
have u added a delegate event for the button clicked like in the example below.
////////WebUserControl1
public partial class WebUserControl1 : System.Web.UI.UserControl
{public delegate void ButtonClciked(object sender, EventArgs e);
public event B...
I have a web user control being used by another web user control, but the one being used will not display the labels in the resx file.
I am using DotNetNuke version 3.13 (might be 3.013) on a Window's XP machine, SP2. I have what I find to be an extremely odd situation. I have a project called TDS.Controls. This project is a web control library. Each control has its own resx file, which is located in the App_LocalResources directory. Each control inherits from Framework.UserControlBase, just like DotNetNuke's User control in DNN\Controls\User.ascx.vb. As a matter of fact, this control is doing the exact same thing I am trying to do. It is a web user control with its own resx file being used by another web user control (See ...
Updating a Label control in one user control from another user control
Hi all,
I have a main page in my music store site that has 5 user controls on it with 1 always showing main content and the others being things like a shopping cart, "best sellers", genre list etc (a la amazon). From the main content control I want to be able to set some label controls in my shopping basket control but I just can't seem to work out the syntax for how to do this:
Here's the code I'm using - I'm trying to go to the 4th user control on the page (my shopping basket) then find the appropraite label, cast it locally as a Label then update the value:
Label _so...
user control calling the function of another user control
I've created two user controls that are being placed on a aspx page: control1 and control2. I would like to place a button on control1 and when the user clicks the button, I would like to call a function in control2. How would I do this?
TLAlway take some time for fun!
Um, if this can be done then you would have to use the qualified name... Control2.FunctionName(args) Otherwise, you can't do it this way, but you can do it by writing a Class in your App_Code folder and then have Control2 call said Function and then Control1 can as well. If this post hel...
Calling a User Control function from another User Control
I have several User Controls on my main page. They are basically DataLists that are filled contiginent on one another. How do I call a function in one User Control on the page from another one?
I would not do that. I would more likely have the page control the interactions with both user controls, surface events on one or both of the controls and have the Page level code handle it. Generally, "Reaching Up" is not a great design. Linking the user controls in the way you are looking to will make them less generally usable, because they will depend upon each other.
You could...
Update one user control from another user control
I have two user controls (.ascx files) on one .aspx page. They are in some kind of master-detail relationship. When I select a row in the GridView in first control, second control is populated with editable data. After changing data and clicking update data IS saved but GridView in first control is not updated.How can I cause that data in first control refreshes, but to keep selected row selected?__Please mark post as answer if it helps, if not come back and ask again!
Hi,You need to re-bind the GridView with the updated data source so that it reflects the latest changes. Regarding the cur...
User Control calling function in another user control?
Hey there folks,
I have a user control (UCInside, e.g.) inside another user control (UCOutside). I want to call a function that's contained in UCInside from UCOutside. Since UCInside has an associated class (let's call it ClassInside), I figured I could call the function by a simple ClassInside.UCInside.MyFunction(params)This calls the function, but I then can't seem to access any of web controls in UCInside from that function.
Specifically, I have a RadioButtonList defined in UCInside. I want to retrieve, and then use, the selectedValue in MyFunction. I get an 'object referenc...
Pass value from one User Control to another User Control
I have tried to pass value from one user control to another user
control. Because of Page Auto Postback, Contrls are load before page is
loaded. So I get the value in 2nd UC after one more post back operation.
I have visited many suggessions but I cant solve this. Is anyone can help me to solve this.
Thank U
mfhossain@gmail.com
Muhmmad Fakhrul HossainEmail: mfhossain@gmail.comPhone: +88 01715 111512Web: http://www.mfhossain.info
You'd have to do that through the parent probably in it's Page_Load event handler.
userControl1.publicProperty = userControl2.publicProperty;
 ...
How to bind grid of one user control from another user control
i am having a data grid in one user control say A and there is another user control say B when ever i add some vale in B that is inserted in to database and i want to call A's bind method of grid ...
Please help me
Nilesh Garg
Well, If you can get a hold on Page control of user control then you can easily deal with the othe ruser control.
Try something like this Me.Parent or Me.Page or somethinglike this to take hold on Page control and then you can easilly get instance of othe ruser control.
Alternatively you can have one shared method somewhere in some class. Call it and i...
How to access one user control from another user control on same page
hi,I have two usercontrol on same page. 1.ascx and 2.ascx on abc.aspx . Now I need to access dropdown on 1.ascx frm 2.ascx . Plz help me how can i do this?I have tried Page.findcontrol but as a user control inherits usercontrol class and not page class . its not giving reference to proeprty Page.Findcontrol. I can do page.findcontrol on aspx page but I need to do it on ascx only.plz helpregards,max
Hi Max, you have to expose your DropDownList as a public property which lays inside usercontrol 1. Example: 1 class MyUserControl1 : UserControl
2 {
3
4 p...
Problem sharing a webcontrol in one User Control with another User Control...
Hi,I need to "share" a button in one User Control with another User Control. I have been trying to make it work for a long time, but I am nearly giving up. Please help! (I am coding in ASP.NET 2.0 C#)I have a main page (default.aspx) that contains two User Controls (mainUC.ascx & buttonUC.ascx).At first the User Control mainUC contains text (textHolder) that is clickable and the User Control buttonUC contains a button (editButton) that is disabled.The functionality I need is:1. When I click the text (textHolder in mainUC) the button (editButton in buttonUC) is enabled. This wor...
Unable to access user control's user control's function\property from another user control
Hi, I used to call an user control's user control function as stated below from my user control in ASP.Net 1.1 wucCompany.wucEmployee.GetEmployeeSomething() After migrating to ASP.Net 2.0, I am unable to use any properties/functions(even the public ones) of the user control's User control's from another user control. The way I have to do is create property\function in wucCompany which calls the wucEmployee's property\function and call the wucDepartment.GetEmployeeSomething().Since I need to do this change in too many places, I can...
Is it possible to handle an event raised in one user control that is contained within another user control?
I have a user control that contains a standard asp.net dropdownlist. I created a public event (listchanged) within this user control that I raise when the selectedindexchanged event of the asp.net dropdownlist is fired.
Within the parent usercontrol that contains the usercontrol above, I created an event handler that handles listchanged. The problem is, this handler is never called. The raiseevent in the child control doesn't throw any errors so i am stumped as to why this is. Is it just not possible to catch usercontrol events within another user control? I may just not understand...