Need to manipulate a column before displaying

Discussion in 'ASP .Net Datagrid Control' started by Paul D. Fox, Sep 19, 2005.

  1. Paul D. Fox

    Paul D. Fox Guest

    I am setting a datagrid's Datasource to a Dataset returned from a Web Service. However, I need to manipulate one of the columns. The column being returned is a relative URL, so I need to prefix the column's data with the first part of the URL to make it an Absolute URL. How can I do this so the datagrid column displays this? I'm thinking something like...
    dgDatagrid.DataSource = ListAllDocuments.PTDocRetrieve(txtPTFolderID.Text)
    dgDatagrid.DataBind()

    '********************************************************
    'strPTReturnURI will have the value http://machineName/server.pt"
    '********************************************************

    'I need to prefix the column with a string from strItem, this of course doesn't work, but you get the idea
    strItem = strPTReturnURI & dgDatagrid.Items(6).DataItem
    dgDatagrid.Items(6).DataItem() = strItem

    Paul
    Paul D. Fox, Sep 19, 2005
    #1
    1. Advertising

  2. Paul D. Fox wrote:
    > I am setting a datagrid's Datasource to a Dataset returned from a Web
    > Service. However, I need to manipulate one of the columns. The column
    > being returned is a relative URL, so I need to prefix the column's data
    > with the first part of the URL to make it an Absolute URL. How can I do
    > this so the datagrid column displays this?


    You have a couple of options. One option is to use an ItemTemplate and
    call a helper method, passing in the URL field and manipulating it in
    your method. You can see this method described in more detail here:
    http://datawebcontrols.com/faqs/CustomizingAppearance/CustomizeColumnValue.shtml

    You could also modify the value in the ItemDataBound event. More info at:
    http://datawebcontrols.com/faqs/CustomizingAppearance/ConditionalFormatting.shtml


    hth


    --

    Scott Mitchell [ASP.NET MVP]

    http://www.4GuysFromRolla.com/ScottMitchell
    Scott Mitchell [MVP], Sep 23, 2005
    #2
    1. Advertising

  3. Paul D. Fox

    Paul D. Fox Guest

    Thanks Scott, I already figured out the first approach. However, your
    second approach is pretty cool.

    Paul

    "Scott Mitchell [MVP]" <> wrote in message
    news:8bLYe.3463$...
    > Paul D. Fox wrote:
    >> I am setting a datagrid's Datasource to a Dataset returned from a Web
    >> Service. However, I need to manipulate one of the columns. The column
    >> being returned is a relative URL, so I need to prefix the column's data
    >> with the first part of the URL to make it an Absolute URL. How can I do
    >> this so the datagrid column displays this?

    >
    > You have a couple of options. One option is to use an ItemTemplate and
    > call a helper method, passing in the URL field and manipulating it in your
    > method. You can see this method described in more detail here:
    > http://datawebcontrols.com/faqs/CustomizingAppearance/CustomizeColumnValue.shtml
    >
    > You could also modify the value in the ItemDataBound event. More info at:
    > http://datawebcontrols.com/faqs/CustomizingAppearance/ConditionalFormatting.shtml
    >
    >
    > hth
    >
    >
    > --
    >
    > Scott Mitchell [ASP.NET MVP]
    >
    > http://www.4GuysFromRolla.com/ScottMitchell
    Paul D. Fox, Sep 23, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    735
  2. Dave
    Replies:
    1
    Views:
    328
    Mike Wahler
    Jan 22, 2005
  3. Ray
    Replies:
    0
    Views:
    110
  4. sdfarmer

    Only manipulate Web Control "before" it?

    sdfarmer, Jul 6, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    104
    sdfarmer
    Jul 6, 2005
  5. Replies:
    2
    Views:
    678
    Alessandro Zifiglio
    Jul 20, 2006
Loading...

Share This Page