Setting control values from one user control to another
I have two user controls on a page. Control 1 is view. Control2 is search. User selects value on Control2 and I want to update Control1(View). I cannot find syntax to change values on Control1 from Control2. The following is function on Control1 that is called from Control2 after pageInit and load on Control1. I have tried many many ways to findControl but all fail.
'Function on Control1 called from Control2 after Control1 PageInit/load:
Public Function loadForm...
want to call one c#.net function in one user control from another user control
hi
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...
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;
 ...
Dot Net Nuke (DNN)
Normal
0
false
false
false
MicrosoftInternetExplorer4
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-b...
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...
How to pass control values from one ascx user-control to another???
Our site is set up using a primary default aspx page that is used as the "base page" for everything. On this page, we dynmaically place various user controls at run-time. This gives us a functionality similar to using frames where the outer-frame actually just sits there while various webfiles are loaded inside of it.
Works great except for one thing...
trying to figure out the best way to pass control names/values accross user controls.
When the same usercontrol is posting back to itself this is a non issue. So far most of our functionality has worked well using the local...
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...
Gettin values from one user control in other user control
Hello,I have a web page in which I have to user controls UC1 and UC2.In UC1 there are few text boxes (eg: txtContactNumber etc...)In
UC2 I have a button. On the click of the button I want to get the value
entered in the txtContactNumber textbox which is in UC1 user control.How to do this. Please let me know.Any code for the example if given is appreciated.Thank You.
In the codebehind for UC1 put the following:public string ContactNumber
{
get { return txtContactNumber.Text; }
set { txtContactNumber.Text = value; }
} And in UC2:private string ...
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...
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...
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...
set values on one control from another
I have two controls in a custom module. Control 1 is view. Control2 is search. User selects value on Control2 and I want to update Control1(View). I cannot find syntax to change values on Control1 from Control2. The following is function on Control1 that is called from Control2 after pageInit and load on Control1. I have tried many many ways to findControl but all fail.
'Function on Control1 called from Control2 after Control1 PageInit/load:
Public Function loadFo...
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...
To pass values from one user control to another
Hi,
I have a page where there is a user control. inside that user control(let's say Usercontrol1) i have another user control(lets say Usercontrol2). in the usercontrol2 i have a tree and a button. When the page gets loaded first the treeview in the usercontrol2 should not get populated only when i click on a button in the Usercontrol1, then only the treeview in the Usercontrol2 should get populated. also i want to pass the text of a selected treenode when i click on the usercontrol2's button to a textbox in the userc...