This is a bit of a hypothetical question that has sent me off down the garden path... Say I have a gridview that I'd like to edit... given a method that binds the data..
private void BindGridFirst() {
var data = new List<string>() {
"A","B","C","D","E","F"[code]...
Now presume that I'm looking at this page, and another user has come along and made some changes to the underlying data, and I now go and click the edit button to edit D...
It's exactly the same, but the data is now changed. Once the UI updates, the user is now in edit mode against row C.Not what the user expected or wanted. How should this scenario be handled to avoid such an issue?
I was in a ASP.NET application has heavy traffic of AJAX requests.Once a user login our web application, a session is created to store information of this user's state. Currently, our solution to keep session data consistent is quite simple and brutal: each request needs to acquire a exclusive lock before being processed.
This works fine for tradition web application. But, when the web application turns to support AJAX, it turns to not efficient. It is quite possible that multiple AJAX requests are sent to server at the same time without reloading the web page. If all AJAX requests are serialized by the exclusive lock, the response is not so quick. Anyway, many AJAX requests that doesn't access same session variables are blocked as well.If we don't have a exclusive lock for each requests, then we need to treat all race condition carefully to avoid dead lock. I'm afraid that would make the code complex and buggy.
So, is there any best practice to keep session data consistent and keep code simple and clean?
I have a GridView control hooked up to a datasource that I allow row editing on. I use the standard edit/save/delete buttons that point to the Update, Cancel, and edit GridView commands.
I would like to add an additional button, "Next" inline with the save/cancel button. This would function the same as the save button, but would also add an additional row to the grid, and place that row into edit mode. To do this, I've added code to the Updated event of the GridView, which adds a new record to the db, rebinds the grid, and sets the editindex. This seems work, but the grid does not actually return in edit mode. I stripped out the new record code and simply left the statement to set the editindex, but the grid still will not stay in edit mode.
Is it possible to force the grid to stay in edit mode in this scenario? It appears that unless you set the cancel property of the GridViewUpdatedEventArgs, the Grid is going to flip to view mode. I don't want to set the cancel property in this case, because I want the GridView to trigger my datasource object to save the record.
If this doesn't work, it appears that I will need to allow the update to occur normally, return to the client, and then send another server request to add the record. I'd prefer not to do it this way, I would like to perform the necessary operations in context of one roundtrip.
Here's what the code (simplified) looks like:
protected void Button1_Click(object sender, EventArgs e) { // Works Fine this.sampleDataSource.Insert(); this.sampleGridView.DataBind(); [code]...
Quick question regarding the use of Singleton lifestyle in Windsor, and Asp.Net MVC. If the following class is registered as a singleton am I correct in thinking that I will have a race condition?
public class UserMapper : IMap { public void Map(MyDto dto, MyDomain domain)[code]...
I have a dropdownlist control in grid.On edit item of the grid I have to find the value of the dropdwolist and set it accordingly. tell the code.Its just one line code but I am not able to find the correct way.
from my collection entity I am getting DayOfTheWeek like 1,2...7. 1 for monday , 2 for tuesday like that. Where should I place condition so that in grid view it would display day name rather than corresponding code.
I have four textbox fields for ItemName, ItemDescription, Length and Quantity.
One radiobuttonlist and its listitems are FixedLength and Random Length.
One button field called Submit and one gridview.
In the GridView I have 4 bound columns and 1 template column such as ItemName, ItemDescription, Length, Quantity and IsFixed_f(flag field). I have added one checkbox in the GridView's Template column for the IsFixed_f field.
After entering all textbox fields, I have to select either one listitem in the radiobuttonlist(FixedLength or RandomLength). After completing these things. If I enter the Submit button, all the values in the textbox to be displayed under the GridView's corresponding column name and checkbox to be checked if FixedLength listitem is selected otherwise the checkbox.checked should be false. How to do this?
I am inserting a new record in a form that has two textboxes txtName, txtAge and I am using an ajax calender extender txtDOB and a gridview control gdvDisplayRecords with 3 fields name, dob and age. So when i select any date from ajax calender extender, the gridview must display only those records from the database which have same DOB before i try to add this new record.
I have a gridview that is being populated off of a query that has joins in it. It works fine. However, I want to display one record of all information but then blank out all colunmns accept 1 for the other 3 records that it is picking up. In other words, right now, all three records have duplicate info in them accept this one column. can this be done? Can I somehow blank out other columns based upon what is in the single column? This is all being done in a gridview. I realize it would do a master detail type scenario but I want all of this information to display without someone having to click on a field or anything.
I have a gridview bound to object data source & in its item template i have some labels and one image control and I have a [Status] column in database that store either true or false in bit format . now what i want is if value in status column is true then image control's ImageUrl property should use image ~/images/Show.jpg and if it have false value then it should show ~/images/Hide.jpg.
currently i am using this code it works fine but i think there must be some good better way to achieve this goal. here is the code that i m using
I have one asp.net gridivew where i have written some code and bind it.. itz working fine now my requirment is when ever any gridview row which conatin column 3rd zero(0) i want to hide tht row ..
I have a gridview, in which one of the columns [unitid] is a link that opens up other gridviews. When the [downtime] column is equal to '0', i'd like the link in [unitid] to be removed, and just show that field as text. Here's my code for the gridview:
I want to hide the link button if the status (value 1 or 0) of the form is set to 1. Here is the code I am trying to use.
Protected Sub gv1_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then 'get the cell cell value Dim status As Integer
[code]....
I think my mistake lies in getting the status value (as it ouputs 0 for every application).
I have to write this code to blink particular rows of gridview based on some conditions I found below link which actually does blink but after we click the row. URL...I need that the row should blink as soon as the web page loads.I also tried using the jquery as in below link but it is also giving error as.URL...