I'm a little confused here. In the code-behind of an ASP.NET page, I have a private DataTable that I set on the PageLoad event, which I use to populate controls on the page. However, it seems to get lost (set to Nothing) after the load event.Is this normal?
How do I hold onto a DataTable object after the page loads? This is also very confusing as to how I am supposed to submit updates to the SQLServer db when any changes are mande to that datatable. I mean:
1. PageLoad, set DataTable, set controls values to corresponding columns in Datatable.
2. User changes a textbox value, then start a .BeginEdit(), DataRow("Field) = txtboxvalue.
3. Update button clicked should submit DataTable to Webservice that references a DAL that accepts the DataTable for db update.
I need to send an email to ALL the above unique email addresses in column 2, listing all the logons for that person. My question is, in terms of best practice, Whats the best way to do? Should i either
1) Query the local datatable in the application, if so how do i query a local DataTable object? 2) Modify my initial query to return all the unique email addresses and then again query to retrieve the logons for that email address inside a for loop for eaxmple.
Was trying to minimise the hits to the database, whats the preferred way to do something like this?
If I am passed a datatable and I cant change the column structure..is there anyway to set an existing column to a Primary key so I can easily Find() the row I am looking for?
When I run the application using the Web Developer it works fine. However when I run it using local IIS I get the following error:
The resource class for this page was not found. check if the resource file exists and try again. Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The resource class for this page was not found. heck if the resource file exists and try again.
Source Error:
Line 81: private void PopulateLanguageList() Line 82: { Line 83: DropDownListLanguage.Items[0].Text = (string)HttpContext.GetLocalResourceObject( Line 84: "Default.aspx", SelectLanguage, Thread.CurrentThread.CurrentCulture); Line 85: }
Stack Trace:
[InvalidOperationException: The resource class for this page was not found. Please check if the resource file exists and try again.] System.Web.Compilation.LocalResXResourceProvider.CreateResourceManager() +4038050 System.Web.Compilation.BaseResXResourceProvider.EnsureResourceManager() +23 System.Web.Compilation.BaseResXResourceProvider.GetObject(String resourceKey, CultureInfo culture) +24 System.Web.Compilation.ResourceExpressionBuilder.GetResourceObject(IResourceProvider resourceProvider, String resourceKey, CultureInfo culture, Type objType, String propName) +32 System.Web.HttpContext.GetLocalResourceObject(String virtualPath, String resourceKey, CultureInfo culture) +56 APPortal.Login.PopulateLanguageList() in c:inetpubwwwrootAPPortalDefault.aspx.cs:83 APPortal.Login.Page_Load(Object sender, EventArgs e) in c:inetpubwwwrootAPPortalDefault.aspx.cs:20 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42 System.Web.UI.Control.OnLoad(EventArgs e) +132 System.Web.UI.Control.LoadRecursive() +66 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
I created a website using VS2010. When I run the website using built-in web server, everything works fine. The website recognizes javascript and aurigma uploader. When I publish the website to local folder and tried to access using IIS 5.1 on local pc, the java scipt files did not work. I was getting yellow triangle sign at the bottom of the page indicating the object is expected. I tried to look online but i could not find any answer. I have included jquery and javascript file in the header section of master
There is a hyperlink to a local file...for instance....C:/text.txt. This is not possible, because ASP.net does not allow links to local files. But, links to files on network drives such as W:/test.txt are working ok. how does the browser know which drive letter is local,and which is networked? How does it know that C: is local or D: is local etc, and that W: is a network drive?
How do I get the smtp server address for the local machine? I want to my email address on a windows form and have the user send me an email and I need to be able to get their smtp server address programatically to do this. I tried this:
System.Net.Mail. SmtpClient smtpc = new SmtpClient("127.0.0.1"); smtpc.Send(email);
I have a situation where I write a cookie on one page and read it on another page, but it only works for users who are in the admin group onour web server.On my default page, I have this code in the page load event to get some user data from my database and save it for later use: HttpCookie c = new HttpCookie("userinfo"); c.Values["domainaccount"] = _CtaUser.DomainAccount; c.Values["userid"] = _CtaUser.UserID.ToString(); [code]....
And it's gone.Again, it works for me and one other programmer who are in the admin group on the web server, but not for anyone else.
I have a 3 page vb.net web application (long story, but it has to be multiple pages). Page one has a datagrid that has rows of data. When a user selects a row, I check to see what "RecordType" corresponds to the row selected. If the RecordType = 1, Page Two loads. If the RecordType = 2, Page Three Loads. The problem I've run into, is that once page two or three loads, all the data is lost. In the gridview, I have the several values in the DataKeyNames, but "loose" them all between pages. Is there a way to pass this data to the next page other than ...Session - I guess I could set the values in the datakeynames as session data.. right?
QueryString - I really don't want to use querystrings, as I don't want users "messing" with the URL.Is there another option available in .NET? I'm kind of hesitant to set sessions, because I'm afraid the values won't get cleared out as needed...
I have an upload control (csv file) of which I use the stream to retrieve data in a datatable that I then bind to a datagrid, sitting in a repeater control.I have to bind more than one record to the repeater, therefore I need to find a way of storing the stream for each binding, so that I can bind it to the datagrid again, via itemdatabound event of repeater.
I have tried storing the stream in the repeater's datatable but on each postback, the content of the stream gets lost. The stream still exists, but its length is set to 0.I have tried storing it in a session object, but again it is reset to 0.
I have tried using viewstate but I get a xmlserialization error. Saying IXmlSerialization is not implemented.I am desperate to find a work around as I am feeling the pressure at work.
On my page I have some text boxes that users can enter values in. The first time they submit the page it gets the values from the text box fine. But when the user goes back using their browser back button and changes a value and resubmits, it shows the value from the first time they submitted, not the new value they just entered.
Is there a way to keep (automatically) the data posted before a redirects to the another page? And then reapply the post data to the this Page upon return? Here is what I want to do :
[Code]....
I noticed that some websites are already doing that. Such as phpbb forums, when composing a message and the session expired we are redirected to the login page and then we return to our post without anything lost. However, I know that it is in PHP but it remain a web application at all ;) I thought of a system of modal box that will appear directly in my MasterPage so don't need to redirect, but I do not like the idea. If I don't find any solution this could be a workaround. But I don't like it.
I have had a website on a shared web hosting plan for over a year with no issues with keeping persistence. It's been prettys stable, and the only drawback of the host I am using is that it's very slow on occasion...sometimes taking 5-10 seconds to load a page.
So over the last few weeks, I went searching for another web host and and testing one out now.So while my existing website is still running the old web host, I copied the code and data and pushed it on the new web host. It's up and running, but I noticed that shortly after I log in (Forms Authentication), I am logged off within 20-30 seconds.I decided to add the machineKey to the web.config, and it seems to have fixed it.
My question is why would this have fixed it? I asked if the host's servers were in a web farm.
i have a global field called hotelId. i then have this piece of code that gets a value from gridview row:
[Code]....
the local variable is assigned to my global one, which gets passed to my method along with other variables. while stepping through i can see the value is set, but when i hit the submit button variabl is passed to another method except my hoteId. it gets lost...
I have a gridview with auto Edit buttons... when I click on Edit button it is losing it row and column colors.We are initially setting the gridview colors in the page_load event.
I have a gridview and dropdownlists that I want to use to filter the gridview by. I am trying to mimic the Filter functionality in Excel.The current problems I am having are:The dropdown is losing the selected value during the postback. It selected value goes back to All.I cannot use the dropdownlist to select "All" to remove the filter.ode is below.Page Code:
how to create unlimited user control without losing the data... My problem is on postback.. i searched a lot but m not get solution.. my question is how to recreate unlimited controls(textbox,dropdown) and how to maintain the data in the controls.. Now am able to create dynamic usercontrol (unlimited) when Button click event using for loop but not able to maintain the data during postback.
And inside that gridview you can see I have a dropdownlist called dpdTrueFalse. That dropdown has two values which I am loading from code behind like this...
[Code]....
I have a submit button outside that gridview that checks each row and the selected value in the dropdown. But for some reason, even if you select another item in the dropdown, it always selects the first item in the dropdown when I click the submit button. I reckon its because of the postback.
I have a FormView that is used to insert records into a table. It is set to a default mode of insert. When I click a LinkButton it makes the FormView visible and populates a DropDown List control via code. When I click the Insert button, it inserts the record into the table but then the DropDown List selections disappear. How can I keep the selections so that I only have to fill it once?
I'm new to the asp.net/vb.net world and have stumbled across a problem.I have a page that has a gridview. When the user clicks on a link in the grid a modal popup is shown (using the AJAX modalpopupextender).On this pop up is a treeview that the user can then select some child nodes.When they click a button a table is dynamically populated with the list from the selected treeview nodes.The user can then add detail in this table comments etc and then should be able to click on a save button. This will then fire the event to loop through the table and insert these records into a database.The problem is that when the Save button is clicked the page seems to have lost all reference to the fact that there are dynamically created rows in the table even though there are a number of rows that you can still see displayed on the page. Even the table.rows.count shows 1 at this point!
The child window close, go back to parent window, and reload the page and no confirmation box to refresh the page, working as expected. but all my previous entry to the screen is gone. how to retrieve it back or any work around?
I am trying to upload large videos(more than 1GB) to youtube from webpage. But youtube is allowing me to upload max 8MB videos. So I want to reduce the size of the video and then upload the reduced video to youtube. So, how to reduce the video size.
I'm using Request.PathInfo to response.redirect as user to a different page ( based on the content after .aspx ). It redirect just fine however, once redirected, the page loses all content from the master page and the CSS link.