Need to manipulate a column before displaying

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Need to manipulate a column before displaying

    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 Guest

  2. Similar Questions and Discussions

    1. Summing a column and displaying in the footer
      I would like to sum a column in my dataset and have it displayed at the bottom of the datagrid in the footer. How do I do that?
    2. Empty Column not displaying correctly
      Hi, I have a datagrid where the first column is a Select button and the next 5 columns are databound. I bind the grid to a dataset that conains...
    3. EditItemTemplate column not displaying on first EditCommand click
      For some reason, when I click the edit template command button on my grid, the edit command fires, but the edit template controls don't display. ...
    4. Problem displaying one column of one row from a database with PHP.
      I have a small script with PHP that queries a MySQL database to pull out one row, where I want to be able to access each of the columns separately....
    5. displaying XML data in datagrid column
      i want to display actual XML data (with tags & data) from a table's colum (XML data) in a datagrid's column... by default it shows only yhe...
  3. #2

    Default Re: Need to manipulate a column before displaying

    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:
    [url]http://datawebcontrols.com/faqs/CustomizingAppearance/CustomizeColumnValue.shtml[/url]

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


    hth


    --

    Scott Mitchell [ASP.NET MVP]
    [email]mitchell@4GuysFromRolla.com[/email]
    [url]http://www.4GuysFromRolla.com/ScottMitchell[/url]
    Scott Mitchell [MVP] Guest

  4. #3

    Default Re: Need to manipulate a column before displaying

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

    Paul

    "Scott Mitchell [MVP]" <mitchell@4guysfromrolla.com> wrote in message
    news:8bLYe.3463$Ba2.3318@newssvr27.news.prodigy.ne t...
    > 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:
    > [url]http://datawebcontrols.com/faqs/CustomizingAppearance/CustomizeColumnValue.shtml[/url]
    >
    > You could also modify the value in the ItemDataBound event. More info at:
    > [url]http://datawebcontrols.com/faqs/CustomizingAppearance/ConditionalFormatting.shtml[/url]
    >
    >
    > hth
    >
    >
    > --
    >
    > Scott Mitchell [ASP.NET MVP]
    > [email]mitchell@4GuysFromRolla.com[/email]
    > [url]http://www.4GuysFromRolla.com/ScottMitchell[/url]

    Paul D. Fox Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139