Click here to Skip to main content
15,890,527 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: asp.net question Pin
eyeseetee16-Oct-08 22:16
eyeseetee16-Oct-08 22:16 
QuestionDropdownlist items keep duplicating [modified] Pin
Cyberpulse16-Oct-08 11:48
Cyberpulse16-Oct-08 11:48 
AnswerRe: Dropdownlist items keep duplicating Pin
Caio Kinzel Filho16-Oct-08 12:18
Caio Kinzel Filho16-Oct-08 12:18 
AnswerRe: Dropdownlist items keep duplicating Pin
Venkatesh Mookkan16-Oct-08 16:16
Venkatesh Mookkan16-Oct-08 16:16 
QuestionLocalization Pin
aecordoba16-Oct-08 11:41
aecordoba16-Oct-08 11:41 
QuestionUnable to dynamically set a control's skin after Page_PreInit Pin
Steve Holdorf16-Oct-08 10:29
Steve Holdorf16-Oct-08 10:29 
AnswerRe: Unable to dynamically set a control's skin after Page_PreInit Pin
Steve Holdorf17-Oct-08 19:05
Steve Holdorf17-Oct-08 19:05 
QuestionHow to point to the LINQ db datacontext() for a GridView1_RowUpdated? Pin
pzn3xq16-Oct-08 8:39
pzn3xq16-Oct-08 8:39 
have a grid with LINQ taking care of the update/delete transactions for me. Looking at http://msdn.microsoft.com/en-us/library/bb298529.aspx, I want to setup my optimistic concurrency to overwrite current values. I open 2 instances of the same application and edit the same record. My code catches the concurrency problem in the GridView1_RowUpdated method. Problem is how to resolve it.

Since I have a datagrid with a linqDataSource, I do not have a northwind db = new northwind() in my code. So I created a new instance within teh GridView1_RowUpdated method, but I don't believe this was correct. Therefore, I'm confused how to implement the code below if I'm using a GridView and LINQ to control my edit/delete function?

***Here is my code...I think by creating a new northwindDataContrext on the fly is incorrect b/c it's a new instance that does not have the Concurrency Error...which is the reason my metatables are not returning any information on conflict either.****

protected void GridView1_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
ErrorMessage.Text = "";

if (e.Exception != null && e.Exception.GetType() == typeof(ChangeConflictException))
{

NorthwindDataContext db = new NorthwindDataContext(); **I think this may be incorrect**

foreach (ObjectChangeConflict occ in db.ChangeConflicts)
{

occ.Resolve(RefreshMode.OverwriteCurrentValues, true);

//be sure to add *** using System.Data.Linq.Mapping;
MetaTable metatable = db.Mapping.GetTable(occ.Object.GetType());
MyProduct entityInConflict = (MyProduct)occ.Object;
Label1.Text = "Table name: " + metatable.TableName;
Label1.Text = Label1.Text + "Customer ID: " + entityInConflict.ProductID;
}

ErrorMessage.Text = "Someone changed this record while you were working on it.";
e.ExceptionHandled = true;
e.KeepInEditMode = false;
}
}

****Here is the MSDN code http://msdn.microsoft.com/en-us/library/bb298529.aspx,***
Northwnd db = new Northwnd("...");
try
{
db.SubmitChanges(ConflictMode.ContinueOnConflict);
}

catch (ChangeConflictException e)
{
Console.WriteLine(e.Message);
foreach (ObjectChangeConflict occ in db.ChangeConflicts)
{
// All database values overwrite current values.
occ.Resolve(RefreshMode.OverwriteCurrentValues);
}
}

Thank you
QuestionIntercept http requests and route it to appropriate server Pin
imak16-Oct-08 7:49
imak16-Oct-08 7:49 
AnswerRe: Intercept http requests and route it to appropriate server Pin
Venkatesh Mookkan16-Oct-08 17:21
Venkatesh Mookkan16-Oct-08 17:21 
QuestionCan anybody help me to print the repeater data from asp.net with background colors. Pin
Rahees8316-Oct-08 5:44
Rahees8316-Oct-08 5:44 
Question[Message Deleted] Pin
amit201116-Oct-08 5:11
amit201116-Oct-08 5:11 
AnswerRe: Alphabetical ordering.. Pin
puviyarasan.j16-Oct-08 5:21
puviyarasan.j16-Oct-08 5:21 
GeneralRe: Alphabetical ordering.. Pin
amit201116-Oct-08 5:25
amit201116-Oct-08 5:25 
GeneralRe: Alphabetical ordering.. Pin
Blue_Boy16-Oct-08 6:46
Blue_Boy16-Oct-08 6:46 
AnswerCP IGNORE USER Pin
leckey16-Oct-08 9:46
leckey16-Oct-08 9:46 
GeneralRe: CP IGNORE USER Pin
amit201116-Oct-08 10:11
amit201116-Oct-08 10:11 
GeneralWhy do I bother? Pin
leckey16-Oct-08 16:07
leckey16-Oct-08 16:07 
GeneralRe: Why do I bother? Pin
Paul Conrad16-Oct-08 19:01
professionalPaul Conrad16-Oct-08 19:01 
QuestionFirst off, thank you very much for your help. If you want me to mark this as answered as correct for you I will and post a new question, just tell me. The problem I need to solve, I think, is with textboxes that make up the cells of the grid. When I Pin
Steve Holdorf16-Oct-08 3:56
Steve Holdorf16-Oct-08 3:56 
AnswerRe: First off, thank you very much for your help. If you want me to mark this as answered as correct for you I will and post a new question, just tell me. The problem I need to solve, I think, is with textboxes that make up the cells of the grid. Whe Pin
led mike16-Oct-08 4:44
led mike16-Oct-08 4:44 
GeneralRe: First off, thank you very much for your help. If you want me to mark this as answered as correct for you I will and post a new question, just tell me. The problem I need to solve, I think, is with textboxes that make up the cells of the grid. Whe Pin
Ashfield16-Oct-08 22:55
Ashfield16-Oct-08 22:55 
GeneralRe: First off, thank you very much for your help. If you want me to mark this as answered as correct for you I will and post a new question, just tell me. The problem I need to solve, I think, is with textboxes that make up the cells of the grid. Whe Pin
Steve Holdorf17-Oct-08 2:11
Steve Holdorf17-Oct-08 2:11 
QuestionHow to remove focus from a button. Pin
thomasa16-Oct-08 2:52
thomasa16-Oct-08 2:52 
AnswerRe: How to remove focus from a button. SOLUTION Pin
thomasa16-Oct-08 3:44
thomasa16-Oct-08 3:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.