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
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...
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...
Incorporating user control from Portal Starter Kit to another project
I use Visual Studio.NET 2003 to create a website for my local church. I had a look at the Portal Starter Kit and wish to incorporate some of the user controls (e.g. DesktopPortal Banner.ascx) into my project. Could somone please tell me how to do this in VS.NET 2003?thanksRomeo...
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");
((webcontrols.BrowseItems)UserControl).pnl_browse_main.Controls.Add(ut);
This is how we Load User controls into a content place holder.
try
{
UserCont...
Accordion ContentContainer ==> Add one control, goto another line, add another control, ...
I am trying to make an Ajax Accordion menu, and i am creating within a Content container Hyperlink(control) for each page in my site. The problem is that the links are being placed side by sided and i want them every one in each line inside a pane.Here is my code: 1 protected void Page_Load(object sender, EventArgs e)
2 {
3 Label lblContent = new Label();
4 Label lblHeader = new Label();
5 HyperLink link = new HyperLink();
6 //Pane Controle de Usuário
7 AjaxControlToolkit.AccordionPane aPane = n...
How to make "Required Field Validator" very specific to Button control not to Link button control??? (really helpful to me)
I have placed 1 Textbox, 1 Button and 1 Link Button (Log out) and 1 Required Field Validator (with its controltovalidate = "TextBox").....Now, if i click "Button" without typing anything in the textfield, then i am seeing "Required Field Validator" error message.....BUT IF I CLICK <LINK BUTTON> (LOGOUT), EVEN THEN I GET "Required Field Validator" error message???? in this case, it should not validate the text field?? this is bothering me a lot??? can anyone help me thanks a lot in advance
for the linkbutton to...
Controls.Add in Composite Control that inherits another control
Hi!
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...
There is a Gridview Control in the tmplate field of another GridView Control.
For instance,a gridview displays the information of the students in a class.A table is recording the information except their mark.There is another table recording the mark of the students whose foreign key is the primary key of the previous table.
string strSQLconnection="..................";
SqlConnection sqlCononection=new SqlConnection(strSQLconnection);
SqlCommand sqlCommand=new SqlCommand("select * from stuendent where classID=1",sqlConnection);
SqlConnection.Open();
SqlDataReader reader=sqlCommand.ExecuteReader();
GridVie...
Populating a control in client side on selection of another control
Hey,
i am facing a problem. I need to populate one drop down with all state values depending on the selection of Country in country drop down in my aspx page.
Can u suggest me how i can handle the situation in client side, since the server side code involves so many post back.
I prefer in javascript.
Thanks
if document.getelementbyid('lst').options[1].selected
{
fill ur second list here......
}Vijay MannSoftware Developer Noida India...
Trying to pass values from one control to another control
I have 2 controls on my page. CaseList and Email Reviwer.
CaseList contain a datagrid that when the button (5th column) is clicked 2 values should be passed to the email revier control.
In the email Reviwer Control I have declared:
I have: public void sendCaseIdCatId(int catid,int caseid) { ViewState["EmailReviewerCategoryId"] = catid; ViewState["EmailReviewerCaseid"] = caseid; } in my EmailReviwer control
I tried: //Display the email reviewer panel EmailCaseReviewer.Visible=true; string strcatid = e.Item.Cells[1].Text.ToString(); string strcaseid = e.Item.Cells[0].Text.T...
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...
How can I update a control in one user control from another?
Hi all,
I have a page made up of numeruos user controls. In the first one (header.ascx) I have a literal control called "litPageTitle". However depending on what the user does in one of the other user controls (registration.ascx) I want to change the text in the page title literal.
eg://This code is in the second user control on the page (registration.ascx)
if (currentAction == "1")
ChangePageTitle("Terms and Conditions");
else
if (currentAction == "2")
ChangePageTitle("Contact Details");
else
if (current...
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...