User Profile & Activity

Dave McGoff Member
Page
of 4

Hi Niven,

I updated the culture setting for my grid: 

Culture="en-US"

I then added the currency dataformat to one field:

<ISWebGrid:WebGridColumn DataMember="ExManSales" EditType="NoEdit" Caption="ExManSales" Name="ExManSales" DataType="decimal" DataFormatString="c" />

I am still getting the error:  Message":"$293,503.00 is not a valid value for ...

 

Dave

Hi Niven,

 

What is the Grid's "culture"?  Can you provide an example?

Thanks,

Dave

Posted: November 1, 2010 9:47 AM

Thanks Handy - I will try that.

Do you know the KeyCode for the various arrow keys (up, down, left, right)?

This is how Excel works - the arrow key always moves you from cell to cell.

Posted: October 30, 2010 5:34 PM

Thanks - this example works well.

Do you have an example where you pass data over to the WebService?  I would like to pass all of the checked rows in my grid back to the WebService - at least the ID of each row.

Thanks,


Dave

Posted: October 25, 2010 10:11 PM

Handy,

I get an error:

Microsoft JScript runtime error: 'GetGroupChildRows().length' is null or not an object

When I use your suggested option:


var
selectedObject = grid.GetSelectedObject();

var selectedRow = selectedObject.ToRowObject(); alert(selectedRow.GetCells().GetNamedItem("DoseUnitsPerAdminDay").Text); alert(selectedRow.GetCells().GetNamedItem("DoseUnitsPerAdminDay").Value);

selectedRow.GetGroupChildRows().length;

 

I would like to set the value of a particular column, but just for the rows currently displayed within the group where I am selecting a cell.

Thanks,

Dave

 

Hi Niven,

When will that be, this week?

Is this a bug?

Thanks,

Dave

The error that I see is: " {"Message":"$59.96 is not a valid value for Decimal..."

 

Because the "$" is being sent over to the server.  That formatting needs to be removed before sending the data to the server.

Posted: October 21, 2010 11:17 AM

Moving the columns that were not visible to the end of my grid solved both of my issues.

Thanks!

Hi Maged,
 
Again, thank you for solving this problem.  I have another question...
 
As you know, Intersoft has a class ISNet.Data.Linq.WebGridDataProvider which has two methods that are very useful.  The first is the Select(DataSourceSelectArguments selectArguments) method and the second is the BatchUpdate(List<ClientRowChanges> changes). When a grid displays data for an entity that is mapped to one table, both of these methods work very well.  However, in our case, we want to display data from multiple tables.

 

I already asked you about BatchUpdate in my previous post.  I am also interested in how you implemented the Select method.  Below is my attempt.  I create a query which joins the two tables and places the result in a custom class which I created manually. My solution works but is very inefficient because I have to enumerate the query and place the results into a list.  If I don't, the select method throws the following exception:

 

"IntersoftWebApp1.BugWithOwner' is not a valid metadata type for type filtering operations.
Type filtering is only valid on entity types and complex types."

 

This is my code.  Would you share your solution??

 
var datasource = from b in context.Bugs                  join o in context.Owners on b.BugId equals o.BugId into tl_j                  from j in tl_j.DefaultIfEmpty()                  select new BugWithOwner

                {

                     BugId = b.BugId,

                     ChangeInLast = b.ChangeInLast,

                     Component = b.Component,

                     Dupe = b.Dupe,

                     OpSys = b.OpSys,

                     Severity = b.Severity,

                     Summary = b.Summary,

                     Target = b.Target,

                     OwnerId = j.OwnerId == null ? -1 : j.OwnerId,

                     OwnerName = j.OwnerName == null ? "" : j.OwnerName,

                };

null ? -1 : j.OwnerId,

                     OwnerName = j.OwnerName == null ? "" : j.OwnerName,

                };

null ? "" : j.OwnerName,

                };

 

IList<BugWithOwner> l = new List<BugWithOwner>();

foreach (BugWithOwner p in datasource) l.Add(p);  

WebGridDataProvider<BugWithOwner> provider = new WebGridDataProvider<BugWithOwner>(l.AsQueryable());

 

object data = provider.Select(selectArguments); if (data != null)    return data; throw new InvalidOperationException("Unsupported operation type!");

 

 

Hi Maged,
 
Your solution to the problem works great - thanks!!!
 
I'm assuming that you had to implement the "BatchUpdate" method that is provided by Intersoft because we are using multiple tables.
 
This is my implementation for the update, but it doesn't seem to work.  Can you please provide your implementation??
 
[WebMethod] [GenerateScriptType(typeof(BugWithOwner))] public TransactionResult UpdateBugs(List<ClientRowChanges> changes)

{

BugTrackerModelDataContext context = new BugTrackerModelDataContext(); //WebGridDataProvider<Bug> provider = new WebGridDataProvider<Bug>(context.Bugs.AsQueryable()); //return provider.BatchUpdate(changes); foreach (ClientRowChanges change in changes)

{

BugWithOwner bugWithOwner = (BugWithOwner)change.NewObject; // ------------------ Bug Table -------------------------------------- Bug NewBug = new Bug

{

BugId = bugWithOwner.BugId,

Dupe = bugWithOwner.Dupe,

ChangeInLast = bugWithOwner.ChangeInLast,

Component = bugWithOwner.Component,

Severity = bugWithOwner.Severity,

OpSys = bugWithOwner.OpSys,

Target = bugWithOwner.Target,

Summary = bugWithOwner.Summary,

};

 

// Always returns a result Bug OriginalBug = context.Bugs.Where(b => b.BugId == bugWithOwner.BugId).Single(); // Update the values

OriginalBug.BugId = NewBug.BugId;

OriginalBug.Dupe = NewBug.Dupe;

OriginalBug.ChangeInLast = NewBug.ChangeInLast;

OriginalBug.Component = NewBug.Component;

OriginalBug.Severity = NewBug.Severity;

OriginalBug.OpSys = NewBug.OpSys;

OriginalBug.Target = NewBug.Target;

OriginalBug.Summary = NewBug.Summary;

// ----------------------- Owner Table ------------------------------------ Owner NewOwner = new Owner

{

BugId = bugWithOwner.BugId,

OwnerId = bugWithOwner.OwnerId,

OwnerName = bugWithOwner.OwnerName,

};

// Original data was a left join so this may be null/blank // Updating if (NewOwner.OwnerId != -1)

{

Owner OriginalOwner = context.Owners.Where(o => o.OwnerId == bugWithOwner.OwnerId).Single(); // Only field we can update

OriginalOwner.OwnerName = NewOwner.OwnerName;

}

else if ((NewOwner.OwnerId == -1) && (!string.IsNullOrEmpty(NewOwner.OwnerName)))

{

// Create New

context.Owners.Attach(NewOwner);

}

// Otherwise now Owner data to update

}

// Persist changes

context.SubmitChanges();

// Fake a transaction result TransactionResult tr = new TransactionResult

{

AffectedResults = 0,

Exception = null,

ExceptionHandled = false,

OperationType = DataSourceOperation.BatchUpdate,ReturnValue =

null,

ExceptionHandled = false,

OperationType = DataSourceOperation.BatchUpdate, ReturnValue =

false,

OperationType = DataSourceOperation.BatchUpdate,ReturnValue =

DataSourceOperation.BatchUpdate, ReturnValue = false, ViewName = null,

};

return tr;

}

}

All times are GMT -5. The time now is 11:43 PM.
Previous Next