.NETGURU
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




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification