Data Manipulation with datasource2

Posts   
 
    
Rishi
User
Posts: 69
Joined: 31-Oct-2011
# Posted on: 01-Nov-2011 21:58:05   

Hi,

I am using llbengenpro datasource2, datacontainer= entityCollection to bind data in Infragistic ultra web grid.

I need a suggestion / approach about how to achieve this.

** One of the column of Ultra web grid is editable and i wanted to update this value into database after doing some validation.

** Before rendering data to grid, i wanted to manipulate one of the column data, to make that column hyperlink. How i can change data of entity before binding to the grid.

Thank you in advance for your valuable time and support.

Rishi

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 02-Nov-2011 04:32:55   

Rishi wrote:

** One of the column of Ultra web grid is editable and i wanted to update this value into database after doing some validation.

Hi Rishi. Just make the grid editable, then update the column and click the update button of the grid. The grid automatically send a signal to the LLBLGenProDataSource indicating that something needs to be updated, then this control sends the update. All of this is automatically if you use livePersistence=true. If you use livePersistence=false that means you want to customize the fetch and the save. Read more about this.

Rishi wrote:

** Before rendering data to grid, i wanted to manipulate one of the column data, to make that column hyperlink. How i can change data of entity before binding to the grid.

You could use livePersistence=false and implement the LLBLGenProDataSource's PerformSelect method to manipulate the collection and pass it to the grid.

You also could add a custom property in your entity that make the transformation of some field and return an hiperlink. You can do this in a partial class of your Entity. For instance:

public partial class CustomerEntity
{
     public string CompanyLink
     {
          return string.Format("http://{0}", this.DomainName);
     }
}

Then you can use this property in your Grid column. So you can still use livePersistence=true.

Rishi wrote:

Thank you in advance for your valuable time and support.

Rishi

Sure wink please let us know if you need further help.

David Elizondo | LLBLGen Support Team
Rishi
User
Posts: 69
Joined: 31-Oct-2011
# Posted on: 02-Nov-2011 16:21:08   

With reference to this option:

You could use livePersistence=false and implement the LLBLGenProDataSource's PerformSelect method to manipulate the collection and pass it to the grid.

Can you guide me how i can manipulate collection data, when i am looping through collection and trying to set value for particular object, Value property of that object is only read only.

here what i am trying to do..

For Each form As EntityClasses.EmpFormXfdfEntity In formList

  If form.LastUpdatedTimestamp.HasValue Then

    form.LastUpdatedTimestamp.Value = "<a href=""#Main"" onclick=""return true;"">" & form.LastUpdatedTimestamp.Value.ToString & "</a>"

  End If

Next

I can not do this assignment " form.LastUpdatedTimestamp.Value = " as value is only read only.

daelmo wrote:

Rishi wrote:

** One of the column of Ultra web grid is editable and i wanted to update this value into database after doing some validation.

Hi Rishi. Just make the grid editable, then update the column and click the update button of the grid. The grid automatically send a signal to the LLBLGenProDataSource indicating that something needs to be updated, then this control sends the update. All of this is automatically if you use livePersistence=true. If you use livePersistence=false that means you want to customize the fetch and the save. Read more about this.

Rishi wrote:

** Before rendering data to grid, i wanted to manipulate one of the column data, to make that column hyperlink. How i can change data of entity before binding to the grid.

You could use livePersistence=false and implement the LLBLGenProDataSource's PerformSelect method to manipulate the collection and pass it to the grid.

You also could add a custom property in your entity that make the transformation of some field and return an hiperlink. You can do this in a partial class of your Entity. For instance:

public partial class CustomerEntity
{
     public string CompanyLink
     {
          return string.Format("http://{0}", this.DomainName);
     }
}

Then you can use this property in your Grid column. So you can still use livePersistence=true.

Rishi wrote:

Thank you in advance for your valuable time and support.

Rishi

Sure wink please let us know if you need further help.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-Nov-2011 17:10:06   

form.LastUpdatedTimestamp.Value = "<a href=""#Main"" onclick=""return true;"">" & form.LastUpdatedTimestamp.Value.ToString & "</a>"

I don't think you need to do anything at code behind. You can edit the Column (ItemTemplate) in the aspx file, right?