How do I control one control from another control?
I have a page page1.aspx which is within a master page.
On page I have a table with two cells. Within each cell I have placed two controls (ascx) that I have developed.
Now I'd like to be able to get these two controls to interact. One needs to update the other. One has some search criteria that the other one needs to update its gridview. One needs to make the other visible/not visible at certain times. Out of the box neither control can see each other at all.
Is there a good article or someplace I can find some information on how to do this?
AllAboutFocus.com. Information Technolo...want to call one c#.net function in one user control from another user control
i have two user controls
info.ascx and personal.ascx
i have a function like
in info.ascx i have a function like showdetails()
now i want to access this function from personal.ascx
can i do this ?
thanks in advance.
shwetaThanksshwetaIn a day when don't come across any problem -you can be sure that you are traveling in wrong path
you should better create a class where you will define the "functions" that you need in both files. declare "static" the function and call it like nameofclass.nameoffunction
In a web project you can...Trying to load a control into a control from another control
Exactly as the subject states, I'm trying to load a control into another control from a control loaded into a page, I keep getting this error from the code I have below. I've also tried the findcontrol but it keeps coming up null.
(67): 'System.Web.UI.UserControl' denotes a 'class' where a 'variable' was expected
UserControl ut = ((webcontrols.BrowseItems)UserControl).LoadControl("BrowseItems");
This is how we Load User controls into a content place holder.
UserCont...Web Custom Control
Hi. I created 4 drop downlist controls as web custom controls, which I would either like to use seperately, or working together like a hierarchy (dependant on each other). The problem is, I need to communicate with the calling control (the web page where I dragged these controls on). When the dropdownlists are used seperately, they should return all items on a table, but when they are used together, the child dropdownlist should only return items from the table based on the selection of the parent dropdownlist just above it. Can anyone please help? Thanks.
You should post this in the Build...BUG: Image Controls in UpdateProgess Control: Can not use FindControl() methods to get Image
There is a single UpdateProgress control on the page. as such:
<ajax:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="100" >
<ProgressTemplate> <div style="border:2px solid #0099FF; background-color:#EFEFEF; padding:10px; width:200px; height:20px;">
</div&...Calling controls from controlls
ok lets see how i do this
my pages are calling 2 diferent controls
ctrlNav and ctrBbody
Now what i need is that the ctrlNav calls a function on the ctrBbody.
how i call it from the page is.
ctrBbody.Speech = "Hello! Word";
Thanks for all the helpyou know the code will allways work
Define a public variable of type ctrlBody in your ctrlNav. In your page assign this ctrlBody to this variable, now inside your control navigation you can use this variable and call any function on ctrlBody
Please mark post as answer if it helped youMy Blog
how would...Why is my ATLAS TEMPLATED USER CONTROL getting all instances of this controls methods called? I only want it called for the instance that I click the button from...
I have created a templated user control and it uses ATLAS. So...once the control loads, it then makes an ajax call to populate itself. "server" UpdateMode="Conditional" ID="UpdatePanel1" ChildrenAsTriggers="False" >
<%# Container.Row["NewsID"] %> - "BNP35.aspx?newsId=<%# Container.Row["NewsID"]%>&promoId=<%# TN...Can a user control communicate with another user control
I have several .ascx user controls on a page. Can they communicate with each other, or can they communicate with the page they are on? I guess I got in over my head by developing the page with user controls. Should I just remove the user controls and design the page without any? How do other people do it? Seems to me user controls are totally useless if you cannot place a value in one from another, or from the main page.
You can create public properties in user controls, as with any other construct. Give the UC an ID in the page, and the page can manipulate those public properties.As...Can a user control contain another user control?
Sincerely,remedyMCP + Senior .NET DeveloperVista: Worth every penny.
Yes, of course.Bertrand----This posting is provided "AS IS" with no warranties, and confers no rights.
yes! this's ok!no problem!...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...How can a custom control view another control property ?
I have a custom control on a page. However, its value is dependant upon another control's value. Is there a way for the custom control to 'see' other controls on the same page ? I guess the only way I could do this is through a global variable ?
Hello my friend,
Both of these controls would be on the same page. The Page_PreRender method of the page executes after controls within it have been loaded. Therefore, within the Page_PreRender event of the asp page you would have the following: -
MyUserControl1.lblMessage.Text = TextBox1.Text
This assumes lblMessage is a lab...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...Controls.Add in Composite Control that inherits another control
I created a composite control that inherits from the WebControls.Button. I added the following in the Load event:
Dim mHidden As New WebControls.HiddenField Me.Controls.Add(mHidden)
but the control is not created. Why?Dimitris PapadimitriouSoftware Development Professional
Hi,Child controls on Button do not make much sense (how would you expect them to be rendered, doesn't button allow only text into value attribute?). Button allows child controls to be added, but they won't be rendered b...Getting the control id of a control inside gridview control
uhmm.. a little bit confusing regarding my subject because i dont know how to say it...by the way my problem is how can i get the id of a control (e.g. textbox) inside the gridview... and the textbox is in the templatefield... is there any way i can get its id?? hoping i could get a reply as soon as possible... Regards,MhaeyPlease remember to click “Mark as Answer” on the post that helps you.. =)
What do you want's to do by getting the id of the Text box?
Do you want's to find particular Textbox with certain id ?
Kamran ShahidSr. Software Engineer(MCP,MCAD.net,MC...