hi all,
how can I populate one aspx form when page is loading based on page ID? for
example:
loading page A (to search for VB code) would display labels and texboxes,
dropdown lists all related to VB, plus the address bar would show something
like this: www.somethinghere?id=3
and if you change number 3 from the address bar to (for example) 34 or 71
you would get different page with the same formatting like I.e: www.somethinghere?id=34 would load the page related to C# topics and all
labels and texboxes and dropdown lists related to C# OR www.somethinghere?id=71 would load the page related to ASP.NET for example
and labels and textboxes would be populated according to ASP.NET and so
on...
my question is, how do they do that? they must assign an ID number for each
topic but then how they populate all controls on that ONE page accordingly?
I am very much interested in this approach and wants to know how its done
and how can I get more info about it. I think its better than duplicating
pages if you were going to use them over and over?
what do you think?
please let me know
thanks 9 7041
id=XX part of the url is available as Request.QuerySt ring.
Request.QuerySt ring["id"] for www.somethinghere?id=71 will return "71".
PageLoad event code can read the id and setup the page controls accordingly.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"netasp" <ne****@newsgro ups.nospamwrote in message
news:O6******** ******@TK2MSFTN GP02.phx.gbl...
hi all,
how can I populate one aspx form when page is loading based on page ID?
for example:
loading page A (to search for VB code) would display labels and texboxes,
dropdown lists all related to VB, plus the address bar would show
something like this: www.somethinghere?id=3
and if you change number 3 from the address bar to (for example) 34 or 71
you would get different page with the same formatting like I.e: www.somethinghere?id=34 would load the page related to C# topics and all
labels and texboxes and dropdown lists related to C# OR www.somethinghere?id=71 would load the page related to ASP.NET for example
and labels and textboxes would be populated according to ASP.NET and so
on...
my question is, how do they do that? they must assign an ID number for
each topic but then how they populate all controls on that ONE page
accordingly?
I am very much interested in this approach and wants to know how its done
and how can I get more info about it. I think its better than duplicating
pages if you were going to use them over and over?
what do you think?
please let me know
thanks
thanks Eliyahu for your reply,
does this method considered to be a good or bad practice with visual studio
2005? because I also have seen some other web applications using different
pages for each category page, their address bar would show aspx pages I.e
employee.aspx, manager.aspx, supervisor.aspx instead of loading everything
into one template page.
I just want to know what is the best practice and recommendation for such a
scenario?
thanks again
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
id=XX part of the url is available as Request.QuerySt ring.
Request.QuerySt ring["id"] for www.somethinghere?id=71 will return "71".
PageLoad event code can read the id and setup the page controls
accordingly.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"netasp" <ne****@newsgro ups.nospamwrote in message
news:O6******** ******@TK2MSFTN GP02.phx.gbl...
>hi all, how can I populate one aspx form when page is loading based on page ID? for example: loading page A (to search for VB code) would display labels and texboxes, dropdown lists all related to VB, plus the address bar would show something like this: www.somethinghere?id=3
and if you change number 3 from the address bar to (for example) 34 or 71 you would get different page with the same formatting like I.e: www.somethinghere?id=34 would load the page related to C# topics and all labels and texboxes and dropdown lists related to C# OR www.somethinghere?id=71 would load the page related to ASP.NET for example and labels and textboxes would be populated according to ASP.NET and so on...
my question is, how do they do that? they must assign an ID number for each topic but then how they populate all controls on that ONE page accordingly?
I am very much interested in this approach and wants to know how its done and how can I get more info about it. I think its better than duplicating pages if you were going to use them over and over?
what do you think?
please let me know
thanks
Hello Netasp,
In ASP.NET, dynamically creating webcontrols is naturally supported. Here
are some web articles introducing this:
#HOW TO: Dynamically Create Controls in ASP.NET by Using Visual C# .NET http://support.microsoft.com/kb/317794/EN-US/
#Adding Controls to a Web Forms Page Programmaticall y http://authors.aspalliance.com/aspxt...ingcontrolstow
ebformspageprog rammatically.as px
#How to: Add Controls to an ASP.NET Web Page Programmaticall y http://msdn2.microsoft.com/en-us/library/kyt0fzt1.aspx
for your scenario, you want to generate two page UI for different client
user requests(search for VB or c#), I think you need to consider the
following things:
Which one is more important for our application, flexibiilty or
performance?
When we dynamically create the page UI depend on different client requests,
it make the page very flexible and easy to extend when you want to add
additional UI template(such as search for J#...). However, the drawback
here is that dynamically creating control will add performance overhead
which is less efficient than statically compiled and loaded page/controls.
Also, making the page UI dynamically generated will make the line of code
in your page increase significantly.
IMO, for those pages which as definitely different code logic and business
purpose or the UI differ from each other obviously, I would recommend you
create separate page for each one.
If the UI of those pages are similar and easy to be templated, you can
consider creating a page to dynamically generate UI.
Please feel free to let me know if you have any further questions.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
thank you Steven for your reply,
how about this:
I create the page and add all the necessary controls to it, dropdown list,
an image box, labels and some textboxes (with generic names) -// so there is
not an overhead of creating controls dynamically
then, if the user clicks the ASP.NET link for example (and lets say it has
been assigned ID=1) then I go to my database and load the appropriate
control names and images for the C# page! OR if the user clicks C# link
(which lets also assume it has been assigned to ID=21) then I will load from
another table all the appropriate names for labels, textboxes and images for
that C# page.
what do you think? would that cut half of my overhead expenses? considering
the controls are already been created?
I would love to hear your input on this approach.
thank you very much for the links
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:hp******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hello Netasp,
In ASP.NET, dynamically creating webcontrols is naturally supported. Here
are some web articles introducing this:
#HOW TO: Dynamically Create Controls in ASP.NET by Using Visual C# .NET http://support.microsoft.com/kb/317794/EN-US/
#Adding Controls to a Web Forms Page Programmaticall y http://authors.aspalliance.com/aspxt...ingcontrolstow
ebformspageprog rammatically.as px
#How to: Add Controls to an ASP.NET Web Page Programmaticall y http://msdn2.microsoft.com/en-us/library/kyt0fzt1.aspx
for your scenario, you want to generate two page UI for different client
user requests(search for VB or c#), I think you need to consider the
following things:
Which one is more important for our application, flexibiilty or
performance?
When we dynamically create the page UI depend on different client
requests,
it make the page very flexible and easy to extend when you want to add
additional UI template(such as search for J#...). However, the drawback
here is that dynamically creating control will add performance overhead
which is less efficient than statically compiled and loaded page/controls.
Also, making the page UI dynamically generated will make the line of code
in your page increase significantly.
IMO, for those pages which as definitely different code logic and business
purpose or the UI differ from each other obviously, I would recommend you
create separate page for each one.
If the UI of those pages are similar and easy to be templated, you can
consider creating a page to dynamically generate UI.
Please feel free to let me know if you have any further questions.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
Thanks for your reply Netasp,
As for the new idea you mentioned, do you mean you predefine all the
controls on the page and assigned fixed ID for each one. and dynamically
load their string resources( such as Text ....) from file or database and
assign to their "Text" property? If this is the case, I think it doable.
Of course, if the controls are defined at design-time, it will save lots of
dynamic control creating and loading overhead.
Please let me know if you have any further questions.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
thanks Steven for your reply,
yeah, this is very much the idea, and I think its better than creating more
than one aspx page that does exactly the same thing.
it seems doable so far, and I will pick up any issues as I advance.
thanks for your help.
best regard,
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:9Q******** ******@TK2MSFTN GXA01.phx.gbl.. .
Thanks for your reply Netasp,
As for the new idea you mentioned, do you mean you predefine all the
controls on the page and assigned fixed ID for each one. and dynamically
load their string resources( such as Text ....) from file or database and
assign to their "Text" property? If this is the case, I think it doable.
Of course, if the controls are defined at design-time, it will save lots
of
dynamic control creating and loading overhead.
Please let me know if you have any further questions.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
Thanks for the followup Netasp,
Yes, this is a good idea. Actually, what you do is just how ASP.NET
application do localization support for web pages. ASP.NET support creating
resource files for each page or the whole application and we can load
string or other resource(like image, files) from resource file according
different CultureInfo. So for your case here, instead of depending on
CultureInfo, your page's resource are depend on other criteria.
Please feel free to post here if you meet any further problem.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
now I have one final question,
what is the best reliable way of loading a control value from a database?
lets say I have label1 already sitting in my webform how can I load its
content "Books" from a table1 in sql 2005 database?
do I use a normal adapter to loop through? is there a good examples
illustrating how to accomplish that?
thanks
"netasp" <ne****@newsgro ups.nospamwrote in message
news:%2******** *******@TK2MSFT NGP02.phx.gbl.. .
thanks Steven for your reply,
yeah, this is very much the idea, and I think its better than creating
more than one aspx page that does exactly the same thing.
it seems doable so far, and I will pick up any issues as I advance.
thanks for your help.
best regard,
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:9Q******** ******@TK2MSFTN GXA01.phx.gbl.. .
>Thanks for your reply Netasp,
As for the new idea you mentioned, do you mean you predefine all the controls on the page and assigned fixed ID for each one. and dynamically load their string resources( such as Text ....) from file or database and assign to their "Text" property? If this is the case, I think it doable.
Of course, if the controls are defined at design-time, it will save lots of dynamic control creating and loading overhead.
Please let me know if you have any further questions.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Netasp,
how you'll read the static data from database depend on how will you use
them. If you will only load them at each page's startup time and will
requrey database if require them later, I suggest you use Sqlcommand +
DataReader to query the data since this will have better performance.
If you will load the data and also cached them in local memory for later
use, you can consider use TableAdpater and return them in the form of
DataTable, Dataset ....
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Janus |
last post by:
Hello.
I need a little advice for populating the treeview control.
I dont want my application to hang while populating the treeview, there is a lot of data what's the best approach?
Maybe something eventbased but how? please help...
Should I avoid populating the treeview control using a thread?
|
by: Tim T |
last post by:
Hi,
I have the need to use dynamically loaded user controls in a webform page.
I have the controls loading dynamically, and that part works fine. this is
the code used in a webform to dynamically load one of several controls:
private void btnCategory_Click(object sender, System.EventArgs e)
{
Control myControl = LoadControl(DropDownList1.SelectedItem.Text +
".ascx");
PlaceHolder1.Controls.Add(myControl);
|
by: Donald Xie |
last post by:
Hi,
I noticed an interesting effect when working with controls that are
dynamically loaded. For instance, on a web form with a PlaceHolder control
named ImageHolder, I dynamically add an image button at runtime:
//----- Code snippet
protected System.Web.UI.WebControls.PlaceHolder ImageHolder;
private void Page_Load(object sender, System.EventArgs e)
|
by: Kamal Jeet Singh |
last post by:
Hi Friends !!
I am have facing problem in controlling the dynamically created
controls on web page. The problem Scenario is
Scenario:- My requirement is to load the web user controls on the web
page dynamically. To do this, First I including a web page
(MainPage.aspx) and I made form tag to Runat=Server. I included one
table tag and also made this table Runat=Server side. Second I created
three Web User Controls e.g....
|
by: Kamal Jeet Singh |
last post by:
Hi Friends !!
I am facing problem in controlling the dynamically created
controls on web page. The problem Scenario is
Scenario:- My requirement is to load the web user controls on the web
page dynamically. To do this, First I including a web page
(MainPage.aspx) and I made form tag to Runat=Server. I included one
table tag and also made this table Runat=Server side. Second I created
three Web User Controls e.g. wucCustomerInfo.ascx,
| |
by: Wim |
last post by:
Hi Everyone,
I'm trying to speed up a Asp.net 1.1 applications' performance. The
application needs to run in an environment with little bandwith and
therefore pagesizes and roundtrip times shoud be brought back to a
minimum.
The application suffered from relatively large screens. A typical aspx
page was 500 Kbyte so page load times were in the order of 40 - 50
seconds. After unsufficient loading improvement using .net caching
|
by: |
last post by:
Trying to learn about manipulating collections of objects, and populating
these objects dynamically from datasources. Could someone post a code sample
that shows the following:
Instantiating a collection object -- say, a dictionary.
Populating that collection object with custom objects, say, Person. What I
really want to see is how to populate the properties of those Person objects
from a datasource: instantiate one Person, fill...
|
by: Joe |
last post by:
Hello All:
I am trying to dynamically populate a web page with literal content and
controls (textboxes and checkboxes (and eventually two buttons - the buttons
do not appear in the code yet). I read an xml file and, using the values
retrieved from it, determine what text should be displayed and which controls
should be rendered and - most importantly - where those controls should be
rendered.
The ultimate goal is to have some text...
|
by: TB |
last post by:
Hi All:
I have this page where a rows / cells are programmatically added to to
table by pushing a button.
The rows contain a textbox and a associated button. What I want to is
to be able to add the content of any textbox to a global variable (and
a related session variable) when pushing the associate button.
However whenever I push the button(s) apparently the session variable
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |