Just a bit of advice needed really in terms of how I should handle my current scenario:
I have a web page that searches for products/category information the results of which are at present displayed in a gridview on the same page.
However, said gridview is a bit of a beast and as such, I would like to have a page that the user searches for, a button is pressed and the subsequent gridview is displayed in a new window.
Ultimately, I would like the user to be able to make multiple searches so that new windows can have multiple gridviews containing different data sets.
My current thinking is to create session variables that can be pulled through onto 'the gridview page'. Having said that, I'm not sure that would work if multiple searches are created?
I am also thinking I might be able to create said 'gridview window' using javascript but my concern here is the potential loss of functionality of the gridview i.e. paging, sorting, editing, etc.
Does anyone have any thoughts or theories on this? What would be "best practise"? Any thoughts greatly appreciated and taken on board.
PS: This is being developed in .net, using c# and LINQ.
PPS: I'm a noob so be gentle!!
There is no need of sessions here right ? well on your first page where you enter search query, when user clicks on the button open the search result page in a new window with a query string may be search.aspx?keyword=foo.
so everytime user clicks on search button it keeps on opening new windows. u can javascript to open the new popup window and set "target" attribute to "Blank" so it will open in new window
Related
I have a grid view and an edit button in the grid view. On edit button click I am opening a new aspx page that has text fields for input the data. When a user copies the URL of the gridview and opens it in a new tab of any browser then click on the edit button for two different records. If the user changes anything in the first tab and submits it. It changes the info for the record on the second tab. It is happening because I am passing userid in session to the form aspx page and session got updated when user opens the second record in the new tab.
Are there only two ways to passing data to aspx page?
using session
using a query string
I don't want to use the query string.
Please help thank you.
You are writing a ASP.Net application, so at the end of the day there is only that much you can do. You can request some things off the browser, but if he actually does it is entirely up to it.
You can make it unlikely to happen by accident, using the HTML Links target property. This requests the browser to re-use any alread open tabs for this record. But that will not prevent a dedicated person from still opening 2 copies.
A pretty simple way to avoid race conditions in general, is the SQL rowversion column. You retreive the rowversion with the rest. You keep it along in a hidden formular field (that is what they are there for). When writing the update, check if it still matches before the write. If yes, you update. If not, somebody has modified the record since then and you reject the update. Can be the same user in another tab, can be another user at the end of the world. Could be that this tab was opened a year ago, surviving on sleep mode. It does not mater - any change trips this protection.
I have struggled to find a solution to this problem through lots of Google searching and documentation reading, and even looking at others’ source code, but I am putting it here in the hopes that someone knows how to help me or has specific experience in dealing with such a thing.
I am currently working on an ASP.NET WebForms project with some of my colleagues, and we have decided to go with an option of which I was not a fan. We have created a page where the user will be required to fill out the university classes they have taken, with related data, in a massive sheet of dropdown menus.
These dropdown menus are pulling their associated data for the user to choose from the database (SQL Server, a.k.a. “Microsoft SQL”), as a way to partially limit user error. The user will make their selections on none, one, some, or multiple dropdowns from multiple “rows” on this page.
My question is how I can write an SQL Server query, and thus, stored procedure, that will allow for a “submit” or “save changes” button to be added to this page. When a user clicks this button, presumably, all of the changes that they have made on any of these “rows” – one row per class – will be added to the database for their respective user account.
My suggestion was having that page be an ASP.NET Grid View that would update with the classes that the user had taken as they entered them. There would be a button at the top of the page where the user could click “Add Class”, and they would be taken to a model popup or some other page, and they would enter the details of that class, mostly through predefined information that is pulled from the database. In the case of an administrator user, they would essentially be able to put whatever information in for the class, because they have the ability to override the strictly regulated format for regular (student) users.
I am at a loss as to how this is best handled in asp.net
I have a webpage with a lot of panels, and tables that is populated with data from mysql request. Now this data might change depending on an input. All the data are buttons that will open a modal windows displaying data.
My issue is that when I press the button the modal opens, but all the tables are reset to the standard "sql data" and the panels collapses. I basiclly want to be able to post back to the exact spot the user was earlier, including where on the page he had scrolled.
I get that the created html istanse is destroyed as soon as the person moved to the modal but how can i store the current exact state of the webpage so when the user goes back he is met with the exact "copy" he left. I've looked into viewstate and state management, and also to check for postback but still havent been able to solve it.
Is there any good tutorial covering this topic?
I've looked into this: Persisiting the state of a webpage
But thats based on ASP2.0 (im at 4.5) and dated 2006. Would this approach still be my best option or is this fixed in a better way on newer ASP.NET version?
I've been trying to find an answer for this and I'm completely lost.
I have an application that starts with a logon screen, after the client is logged on, it opens an MDI Form in which I have some items on a menu strip. One of them are assets (which is what the app will be used for), and the assets menu has a drop down with different assets to select, PC's, software etc.
When you click on PC's, another window opens within the MDI Form that has a DataGridView on it. And it works great but, I don't want to create a window for each and every connection or table in my databases, I feel this is bad practice.
So what I want is, to be able to change the DGV based on the asset selection, but for the life of me I can't figure out how to do this. I've been trying to pass parameters from one form to the other but the I just get different errors etc.
Can you guys please point me in the right direction? I am new to visual studio etc and want to learn these things, so I'm not asking for freebies so to speak, just what the logic should look like more or less.
Thanx!!
I don't have code for what I'm trying to do because I have no idea what the logic should look like.
I'm still trying wrap my head around how two forms communicate in a way I need.
I'm used having variables in a loop and when they change values the result changes. But in visual studio everything needs to be called which makes it a bit difficult for a rookie like me.
I did try sending sql commands via variables, but read that, that is a very bad idea.
I just want the DGV to change the data its showing based on a button selection.
I have a webapp that renders a chart as per the user input by pulling out the data from a oracle database. I want the chart to be rendered on a new popup window so that the chart is persisted from different user input. i want to do this so that the user can render multiple charts in separate popup windows (with different filters for the data to acquired from the db) with the same button click (multiple clicks and separate filter values of course) and then do comparison between the charts as per they wish. so if there are 10 diff filters and the user wants to see the graphs with any combination of them - he will specify separate filter values each time and hit the button to render the chart in a separate new pop up (and the previous popup with previous chart should persist).
I am not really good with javascripts. i found some solutions to use modal popups from ajax and some other with the help of javascripts - none of which seems to serve my purpose. any help would be really appreciated. i am using .net 4.5, asp and c#
thanks.
EDIT 1 (for DJ KRAZE):
So here is the basic layout of my page (sorry that i have to hide most of the part because of security reasons).
As evident all the filters are there to be used to filter out a database and then plot the result as the chart shown. The code behind is absolutely simple C#, nothing fancy. Now what I want is to render that chart in a separate popup window (not attached to the page itself) so that the chart persists if the user decides not to close it and another popup window opens when the user hits submit again with different filter values. so far i have referred to this example and some other javascript related example that does open popups but will not persist if the user has to change the filters -link to example
why don't you just create any many panels one below another -with a close button- as needed to show the results?
firing too many popups might clutter the view.