what am i missing
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.aspnet.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

IGotYourDotNet (VIP)
What am I missing in this code? I'm trying to combine 2 datagrid columns and
it works but its only combining every other row.

Private Sub dgCars_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgRoster.ItemDataBound
Dim make As String
Dim model As String

If e.Item.ItemType = ListItemType.Item Then
make= e.Item.DataItem("MAKE").ToString
model= e.Item.DataItem("MODEL").ToString
e.Item.Cells(1).Text = make & "-" & model
End If
End Sub

this is combining the columns but only every other row is being combined
Reply to this message...
 
    
Hermit Dave
instead of doing the binding on the client side... i would suggest doing it
on server side.
ie in your select query.

select col1, make + ' ' + model as MakeModel, col3 etc from Item

and i generally dont use the method you are using ... i would prefer to
writing to two labels which are invisible and reading them to write to
either one of two or a third one.

unfortunately i dont read vb.net code much and i havent used the method so
cant help with that. Sorry about that.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"IGotYourDotNet" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
> What am I missing in this code? I'm trying to combine 2 datagrid columns
and
[Original message clipped]

Reply to this message...
 
    
Mike
I'm not using straight SQL, i'm calling a SP and using a web service which
returns a dataset to populate the grid
"Hermit Dave" <Click here to reveal e-mail address> wrote in message
news:%Click here to reveal e-mail address...
> instead of doing the binding on the client side... i would suggest doing
it
[Original message clipped]

Reply to this message...
 
    
Greg Burns
Try

If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Or _
e.Item.ItemType = ListItemType.SelectedItem Then

...
End If

If your sproc is being filled into a datatable, you could add
datatcolumn.expression="MAKE & '-' & MODEL" before filling the table.

I think that is legal syntax for an expression...

HTH,
Greg

"Mike" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Web.UI.WebControls.DataGridItemEventArgs
System.Web.UI.WebControls.ListItemType




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com