Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Need to manipulate a column before displaying

Reply
Thread Tools

Need to manipulate a column before displaying

 
 
Paul D. Fox
Guest
Posts: n/a
 
      09-19-2005
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

 
Reply With Quote
 
 
 
 
Scott Mitchell [MVP]
Guest
Posts: n/a
 
      09-23-2005
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/Cust...umnValue.shtml

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


hth


--

Scott Mitchell [ASP.NET MVP]
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.4GuysFromRolla.com/ScottMitchell
 
Reply With Quote
 
 
 
 
Paul D. Fox
Guest
Posts: n/a
 
      09-23-2005
Thanks Scott, I already figured out the first approach. However, your
second approach is pretty cool.

Paul

"Scott Mitchell [MVP]" <(E-Mail Removed)> wrote in message
news:8bLYe.3463$(E-Mail Removed) 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:
> http://datawebcontrols.com/faqs/Cust...umnValue.shtml
>
> You could also modify the value in the ItemDataBound event. More info at:
> http://datawebcontrols.com/faqs/Cust...rmatting.shtml
>
>
> hth
>
>
> --
>
> Scott Mitchell [ASP.NET MVP]
> (E-Mail Removed)
> http://www.4GuysFromRolla.com/ScottMitchell



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sortable column on DataGrid -- column header not displaying Teej ASP .Net Datagrid Control 2 08-15-2006 06:23 PM
Retireve data with SqlDatasource & dynamically manipulate before dispalying collinsd@thewinesociety.com ASP .Net Web Controls 2 07-20-2006 04:26 PM
how to manipulate a drop down list to show multiple column marty.overdear@intergraph.com ASP .Net 2 09-09-2005 08:48 PM
Only manipulate Web Control "before" it? sdfarmer ASP .Net Web Controls 0 07-06-2005 10:44 AM
To manipulate or not to manipulate Dave C++ 1 01-22-2005 10:52 PM



Advertisments