|
if this is a web application then why you are using c:\ .... it should be ~\\Files\\xxx.
to pass data between web forms there are many ways. but you can use Session.
in Form 1 at the Button Click.
StreamWriter sw;
string TextFile = @"C:\Desktop\Text" +x +".txt"
sw=File.CreateText(TextFile);
StreamWriter sw;
Session["TextFile"] = TextFile;
and in Form 2 Page_Load
string TextFile = (string) Session["TextFile"];
but still you need to read more about Session and File Handling.
|
|
|
|
|
I'm using C:\ because I'm running this on the localhost and the file is shared on my network. The text file is then picked up by a program on another machine on the network. This program will make changes that my machine reads out in form 2. Is there a better way to save this text file that can still achieve these results? I'm not familiar with ~\\Files\\xxxx
Thank you for your advice on the session state. I will try that.
|
|
|
|
|
Rutvik,
Thank you for your suggestion of using Session. This worked exactly as I hoped. The only thing I changed was that I placed the text from Form2 in my timer_tick and it worked.
Thanks again!
|
|
|
|
|
I have created an xsd that is well-formed. I have generated classes for the xsd with xsd.exe. I am able to use dot notation to write code to access and set values for all of the attributes.
The problem is that during runtime the child elements are null. Consider the following example where I am trying to set the horsepower attribute value of a Car Engine to 250:
myCar.Engine.horsepower = 250
In this example, Engine is null. However, when I instantiate Car (myCar) I expect the Car instance to automatically have an Engine that I can access to set properties.
I assume that this is probably a problem with my xsd configuration. Can you think of what may need to be changed with my xsd in order to enable the use case that I am describing?
|
|
|
|
|
I am storing an object in a user control's viewstate. This object contains a reference to another object. After retrieving the object from the viewstate, the referenced object is no longer the same as the original (pre-viewstate_referencedobject IS post-viewstate_referencedobject returns false).
Does anyone know how to preserve object references through viewstate?
If you further clarification or code samples, just let me know.
Thanks in advance for your consideration.
modified on Wednesday, January 21, 2009 4:47 PM
|
|
|
|
|
Kindly let me know, how exactly are you referencing the viewstate and what exactly do you require. I mean the complete process.
-----Have A Nice Day-----
|
|
|
|
|
My Results page take 30 seconds or so to query records and render the page to the browser.
On the Results page you can click on a Detail link to view the details of a record. Clicking the browser back button from the Detail page causes the Result page to re query the data. How can I tell it to use the browser cache to display the Result page again instead of having to requery?
|
|
|
|
|
One easy method would be to store the data in session (this will work for a data table or data set) then bind it to the grid. Check to see if the data exists in page load and bind it. Then you don't have to requery the data.
Normally, I would think the back button would cause the page to reload. But I guess it is.
I didn't get any requirements for the signature
|
|
|
|
|
In some cases 10,000 or more records will be in the result. If I use a session variable to store the result datatable would that be potential resource hug on the webserver?
|
|
|
|
|
That depends.
If you have a master page and or base page then when any page other than the detail loads, you can clear session to make sure it is gone in the page load in only one place.
If you do not have a master page or a base page then removing the item from session might be a bit tricky.
If you have 1-5 users at a time you should be OK.
How much you can store in session depends on your IIS settings, hardware and number of users. You can have multiple aspnet worker process and the amount of ram each process can use is configurable.
One easy check would be to open the task manager and go to the processes tab (show from all users) check the w3wp.exe process(es) and see how much ram they are consuming.
I didn't get any requirements for the signature
|
|
|
|
|
Thanks, I will try your suggestions.
|
|
|
|
|
Did you try page level caching
|
|
|
|
|
Hi,
I have written the following function in external JScript.js file.
function validateParameter(textBoxId)
{
var paramname = document.getElementById(textBoxId);
alert(paramname);
}
<asp:button id="btnSaveCom" onclick="btnSaveCom_Click" runat="server" xmlns:asp="#unknown">
Text="Save Comments"
OnClientClick="javascript: return validateParameter('<%=txtParam.ClientID %>');">
But during the runtime it showing the alert message as null.
How to pass the input parameter to the function which in external javascript file.
Tnks in advance!
|
|
|
|
|
Can you try adding the javascript in your code behind? OnPageLoad do
btnSaveCom.attributes.add("onclick", return validateParameter('" + txtParam.ClientID + "');");
If you need to. You can create a second javascript method right in your aspx page.
for example
callValidator(clientId)
{
var paramname = document.getElementById(clientId);
validateParameterWithParamInsteadOfId(paramname);
}
I didn't get any requirements for the signature
|
|
|
|
|
As Todd suggests use code behind
btnSaveCom.OnClientClick = string.Format("validateParameter('{0}')", txtParam.ClientID);
led mike
|
|
|
|
|
use
btnSaveCom.Attributes.Add("OnClick","javascript:return xx('" + btnxx.ClientID + "');");
in the code area.
But you cant alert the parname as its an object. write
alert(paramname).value instead.
Abhishek Sur
|
|
|
|
|
Hi, I know how to make whole site in Secured HTTP (https). but I want to know how I can have only one page as https:// and all other pages of that site is in http:// ????
Like, in any shopping site, all product display pages should be in http:// which is faster but payment gatway page must be in https:// which ensures security.
please help.
Thanks for any help.
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
I don't know if you can do that. Just make a separate web. Any information you need passed between the to can be put in the database or sent via query string. If you do find out how to do this I would be interested in the solution.
I didn't get any requirements for the signature
|
|
|
|
|
Just add a certificate to the whole site. Your links should be http:// links normally. When the user enters the checkout process, just switch to using https:// links...thats all there is to it. You buy SSL certificates for a domain...not really a site. Once its set up for a site on that domain, all you have to do to switch between SSL and non-SSL is change the protocol of your links. You will probably also want to set up some logic in your site to prevent access of secured pages by http.
This article should help: Switch Between HTTP and HTTPS Automatically[^]
|
|
|
|
|
Hello..i have a check box on my content page i want to access this in aspx.cs page..
Thanks..
|
|
|
|
|
buy a book on ASP.NET and follow the examples. Even if I explained this to you in depth, you're going to get stuck again if you don't understand the fundamentals and lose a lot of time waiting for answers here that you can understand.
The checkbox has a name property, you access it by it's name.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks..in my content page i have table in which i have added checkboxes dynamically..i have used page.findcontrol and form.fincontrol and this.fincontrol but not able to find a check boxes..
Thanks..
|
|
|
|
|
When you add controls dynamically, their viewstate is not restored unless you add them before page load, because it's just before page load that viewstate is restored.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi.
In a web form I have 2 user controls.
In one of them I have some textBoxes, and in other one By clicking a button in webform, I need to read the Text property of TextBox of first usercontrol.
But, by clicking the button, the text property is empty. It seems that by PostBacking the webform, usercontrols reLoaded and the stste of them not saved
Best wishes
|
|
|
|
|
When do you check the value ? Does your code ever set the value ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|