|
How to pass values between user controls in same Asp.Net page ?
Thanks in advance!
|
|
|
|
|
Use Properties to set or get the values between UserControls.
|
|
|
|
|
You mean, set/get properties in a user control, define that user control in another control and access the values ?
|
|
|
|
|
Het2109 wrote: You mean, set/get properties in a user control, define that user control in another control and access the values ?
Your question is little bit confusing. Let me explain my point.
Assume that you are having a User Control with a Text Box. You want to set/get the Text of the TextBox in that usercontrol. In that case, add a Text property to the Usercontrol and in that property you update the TextBox in the usercontrol. Here the values in the usercontrol is accessed.
You can implement the same logic in your controls too. If your control has a complicated UI, make use of functions which could return the values in required datatypes or your own class object.
I hope, you understand my point.
|
|
|
|
|
There are many ways to perform your task,
You can have properties in your page instead of user control can access them from the user control ,
or create a function that is going to call by page by passing all parameters from one user control to other,
You can even have a property that will return the whole user control and can access in other user control but its not good practice.
So there can be n different solution the best one you have to pick depending on your requirements.
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
i am using
foreach (GridViewRow row in GridView4.Rows)
((LinkButton)row.Controls[0].Controls[0]).Attributes.Add("onclick", "window.showModalDialog('Lookup.aspx?new=edit&Name="+row.Cells [1].Text +"',null, 'status:no;dialogWidth:555px;dialogHeight:580px;di alogHide:true;help:no;scroll:no')");
THE modal dialog opens and works well...........when i close the modaldialog and again open the dialog clicking the same link then IsPostBack value is true........which effects my data ....... in the dialo i modify my database the database changes ......but when i reopen the page from the link the previously displayed data appears.........But if i close the parent window too then new data appears
Why Ispostback value is true even when i close the modaldialog
Whats the solution....if CS file solution is avaliable it will be easy for me.
i have tried http://forums.asp.net/p/1169965/1961718.aspx#1961718[^]
string strscript = "<script language=javascript>window.opener='';window.open('','_parent','');window.close();</script>";
if ((!ClientScript.IsStartupScriptRegistered("clientScript")))
{
ClientScript.RegisterStartupScript(typeof(Page), "clientScript", strscript);
}
but do not close my dialog
I have checked it again after closing the Dialog when i click the link again the dialog opens but Page_load is not called
Waiting 4 reply
Thanks
modified on Tuesday, March 11, 2008 12:58 PM
|
|
|
|
|
Write in page load
Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
|
|
|
|
cTMPSCRIPT = "<script language='javascript'>" +
"window.open('frmPOPRT.aspx','P/O Preview'," +
"'width=auto,height=auto,toolbar=no,menubar=yes,scrollbar=yes,resizable=yes')</script>";
ClientScript.RegisterStartupScript(this.GetType(), "Preview", cTMPSCRIPT);
This is the code i used. However, when i tried with IE7 and Vista, it won't open new window. This is the error I got.
Line: 61
Char: 1
Error: Invalid argument
Code: 0
URL:....
How can I solve this problem? Please help me. Thanks
|
|
|
|
|
hi
does any body know how can i sort my tags in size order in asp .net and put them together for example like the tags used in searchbox in homepage of www.torrentz.com site
thank you
|
|
|
|
|
hi
i wanna have a button in my dataset which can report the record of the row which the button is in it (every row is a record from a table in database with a certain id and has a button) as an abuse.
i need to know what my onselect function should be
i tried this one but it didn't work:
<asp:ImageButton ID="imgBtnReport" runat="server" ImageUrl="~/images/report.gif"
OnClick='<# Eval("LinkId", "Report({0})">' />
i need to know what should i call on onsubmit event and how should i call it.
thank you so much
|
|
|
|
|
Farhad Eft wrote: i wanna have a button in my dataset
You can't have a button in a DataSet. I think you mean DataGrid. Use a template column.
only two letters away from being an asset
|
|
|
|
|
oops sorry i mean data list!
|
|
|
|
|
Hi!
I am using asp.net web application project in vs 2005. I have treeview webcontrol as a user control on left of the page. based on treenode selection i am creating a datagrid in main page. I maintained the selected node of treeview using sessions now i need to create a bread crumb so that user could navigate through the crumb. could someone help me thanks
|
|
|
|
|
Thanks for looking
Does anyone know how to stop clearing the 2 password fields when createuserwizard fails to create user
Ex: When users already exists, the wizard tells the user to give a different user, but clears the password fields
Anyway to prevent it??
Thanks
Alexei Rodriguez
|
|
|
|
|
write your own ?
It's common behaviour to clear passwords on every postback, most pages do it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I just found out that its the textboxes behavior to clear passwords textboxes on postbacks and that a solution is to save the password on pageload and set it before the page renders
I think there should be an option to clear or not the password on postback
For a user is really anoying to retype passwords just because username already exists
Anyways, ill just try to handle postabacks and not write my own i was doing
Thanks
Alexei Rodriguez
|
|
|
|
|
Hi All,
Still relatively new to .Net and am starting to try new things. I know how to create and use a class that I have created external to a Windows project and am wondering if I could do the same with Web Forms. For instance, let's say I want to perform a function on every page that is loaded. Couldn't I create a class and call that method from the class to do this instead of pasting the code into every page's On_Load event?
Any assistance would be great. Even better would be a short tutorial or example code but this of course is dependent upon your generosity.
Thanks in advance.
|
|
|
|
|
Yes, you can write classes and put them in your app code area, in fact, your pages should not contain business logic, just the UI logic and calls to the middle tier.
The main difference is, every page is a class instance created by the server to serve just one page. Unless you store them in the session, any class instances you create, will not exist between pages.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I was going on this idea of keeping things separate (i.e. Database conversations and the like). My only problem is I am really not certain how to go about it. I have a limited resource at this current time (Pro ASP.NET 2.0 in C#2005) and it doesn't go into how to implement such logic. Can anyone refer another book or article that may give me some more guidance. I don't mind doing the work, I just need a direction.
|
|
|
|
|
ffowler wrote: I was going on this idea of keeping things separate (i.e. Database conversations and the like).
Good idea.
ffowler wrote: Can anyone refer another book or article that may give me some more guidance
http://www.codeproject.com/KB/dotnet/n_tier_web_service.aspx[^]
Basically, you would create class dlls, or in VS2005, just classes in the app code area. Then, your pages will just handle plumbing and create business objects. One common way around the fact that pages have no state, is to store all your objects in a database ( this works if your pages are content driven and need a DB to start with, not if you just have a couple of disparate objects ). Then your pages can pass around ids that are used to build objects from the data base.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Bingo! That will do. I do have other documentation on Web Services so I'll go on from here. Thanks again for your time.
|
|
|
|
|
I am new for sqlserver database connectivity.Can any one help me out?
Thanks,
|
|
|
|
|
This is a basic topic. I suggest you read the MSDN documentation, buy a book on ASP.NET/ADO.NET, or do a quick search of the web.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi.
Has percent (%) any special usage in value of querystrings?
when I use for example %a7 as value, the result is a square, why?
Best wishes
|
|
|
|
|
Read this article[^]
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|