|
Hi guys. I'm new to the MB and ASP.NET as well. I'm developing a Web portal that will drill down the customer's selection of products. The catalog is received via XML from a remote server. They would like the buttons to show up dynamically based on how many records are in the xml. I have all the code written to use XPath and find the specific contents and display the buttons, but since I don't have static buttons I am having a hard time with the click event. I've done some reading on this issue but I still don't quite grasp how to resolve it. It seems even if I set something like btnProduct1.Click += new EventHandler(btnProduct1_Click), the event never fires. After the click the page reloads and I lose the buttons. I am creating the buttons in the Page_Load but this just displays the same buttons I clicked, the event is still ignored. Is there a method I can use to click one of the buttons, and make a call to either a function or transfer to a new page? I just need to bring along the button text to the new page (I am currently loading it in Session.Contents) as those buttons will be created based on what was clicked. Sorry if this is a little long, I want to be sure it is clear what I'm trying to do. Thanks much for any feedback you can provide.
Forrest
|
|
|
|
|
In order to get your postback working, you need to build the page exactly as was before the postback. In other words, you need to generate the page exactly as it was before the button was clicked. The the event will fire...
You can use a property of the buttons (for example the Tag property) to store information about which button was clicked. Determine the button pressed like so
<br />
if (sender is Button)<br />
{<br />
try<br />
{<br />
Button btnPressed = (Button)sender;<br />
}<br />
catch<br />
{<br />
}<br />
}<br />
(place the code in the event handler of your button...
Please vote my message! Click on one of the numbers beside ' Rate this message'.
.: I love it when a plan comes together :.
http://www.zonderpunt.nl
|
|
|
|
|
Hi, thanks for the event code, it was very helpful and so far things are working better!
|
|
|
|
|
Hi,
I was wondering, is there a way to fire a cross-page postback via C# code?
The problems is: I have one error page that displays an error occurred in another page. I don't want to pass the error text through a query string parameter, so I need this kind of approach. And, I cannot use Session to this.
Any hint?
Thanks in advance...
|
|
|
|
|
Can you not pass an error using a code or something.... like errorpage.aspx?e=123 and then check the number to display diffrent errors?
Why can you not use sessions?
Please vote my message! Click on one of the numbers beside ' Rate this message'.
.: I love it when a plan comes together :.
http://www.zonderpunt.nl
|
|
|
|
|
We don't use Session because we have a load balance server configuration. I know, there's a approach for this, but we simply don't use.
TY
|
|
|
|
|
Ah, uh, Server.Transfer()?
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
I'm new to the web and have a site with an SSL certificate but my local Dev machine does not. I just was implementing some security code from from the article "Switching Between HTTP and HTTPS Automatically: Version 2" by Matt Solars and I am having trouble testing it.
What do other developers normally do? Do I need to buy another certificate and install it locally or is there some option I can check on IIS for testing?
Richard
|
|
|
|
|
|
I downloaded and installed the SSL Diagnostics and am running IIS 5.1 but I do not see where I can create a certificate.
Where am I going wrong?
|
|
|
|
|
I am about to create a simple web app and I remember hearing about saving the application configuration in a database from school. This sparked my curiosity and have been searching the web for this technique but I was unsuccessful.
Does anybody know anything about this?
Please point me in the right direction or send sample code to learn from.
Thanks,
Steve C.
kstv@netzero.net
|
|
|
|
|
HI,
Is anybody knows how to export the dataset to excel in a formatted way? I should be able to make the cell bold or italic, or should be able to give background color etc.
When I tried to write it to excel, I'm getting the error message "Exception from HRESULT: 0x800A03EC"}. Anybody pls help.
Thanks in advance.
Meeram395
|
|
|
|
|
|
hi
i want using FormView in my webForm, for update my Data, but when i load data into my FormView and click Update linkButton, nothing occured(nothing postBack occured). how to use FormView for update data ?
|
|
|
|
|
|
well, if u r using VS.NET 2005 u can do it in a very simple way by using an SqlDataSource object. You can configure the SqlDataSource object by appropriately selecting the server name, the database and the table u want to add the data. Then it automatically generates the SELECT,INSERT,UPDATE,DELETE statements or u can use ur own stored Procedures to do them.
then drag n drop a formview on to the application and set it's datasource to SqlDataSource.
e.g: FormView1.DataSource = SqlDataSource1;
FormView1.DataBind();
|
|
|
|
|
It is often to see this tag on a aspx page in which javascript is created with somepage.ashx http handler. Does anyone know how or any good articles talking about how this is done, how to cache the javascript in client side and how to triger a rebuild for the javascript if data changed on server?
<div class="ForumSig">Tom Z. (PMA)</div>
|
|
|
|
|
You can append a random number querystring to the URL to prevent the useragents and proxy servers from caching your file.
|
|
|
|
|
Hello,
In my ASP.NET application I am tracking user behavior ( tracking pages visited by user ) . For doing this I created a HTTPModule and attached with the application. Everything worked smoothly. But my website contains number of HTML pages, so this HTTPModule was not tracking this HTML pages. For doing this, I mapped html and htm extensions to aspnet_isapi.dll in IIS. Now it started to track HTML pages also.
For tracking each user behaviors, I was storing his id in one session. But in HTML pages this session failed to work. It throws "session state is not available in this context exception" . I have added HttpHandlers for html and htm pages and mapped to System.Web.UI.PageHandlerFactory . Still I am getting the same error. Any body please help me to solve this issue ?
If the page is mapped to ASPX engine, then it will be served by that engine rite, So session also should be available. But why this is happening in my scenario ? When I am going wrong ? Please guide me.
|
|
|
|
|
Did you research about IRequiresSessionState marker interface?
|
|
|
|
|
Hello
I am developing an Web Applcation.
What is the maximum timeout for sessionState in web.config so that my Session variables doesn't get destroy.
Swapnil Bhavsar
|
|
|
|
|
By default is 20 minutes and rest u can set it upto life time.
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
According to MS documentation:
The Timeout property cannot be set to a value greater than 525,600 minutes (1 year).
NOTE there is another thing you need to be concerned with. If you are running IIS 6.0 then you are also using an application pool. The application pool by default is set to recycle itself after like 27 hours. If the app pool is recycled you would lose all session information.
Hope that helps.
Ben
|
|
|
|
|
swapnilbhavsar wrote: Applcation
Web Application
swapnilbhavsar wrote: maximum timeout for sessionState in web.config so that my Session variables doesn't get destroy
That much high cost of memory and open idle sessions to remain.
|
|
|
|
|
The maximum timeout for sessions is much larger than any sane person would use.
The purpose of having a timeout on sessions, is that it removes the session objects from memory when they aren't used any more. If you have a very long timeout, you will have a lot of session objects in memory.
Memory is cheap, but it's still a limited resource. If the server starts to run out of memory, it gets tremendously slow.
---
single minded; short sighted; long gone;
|
|
|
|