Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 28th, 2004, 11:08 PM
Authorized User
 
Join Date: Jul 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aravwind Send a message via Yahoo to aravwind
Default Problem in datagrid

vb.net/asp.net
windows2000


i got 3 columns in datagrid. there is a column name in the table "AttachmentDoc". if that is not empty i want to display
an image in the third column of the grid. if that is empty i don't want to display anything.

how would i accomplish.




__________________
Aravindan.N
Faster and consistent will surely beat the slow and steady
 
Old July 29th, 2004, 07:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Use a TemplateColumn and add the image, with the path to the attachment.

Then use an event like ItemCreated or ItemDataBound to find out which one's have an ImageUrl of empty string or  , and remove the image control.

Brian
 
Old July 29th, 2004, 08:22 AM
Authorized User
 
Join Date: Jul 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aravwind Send a message via Yahoo to aravwind
Default

i solved it in different way.
i wrote a function for the AttachmentDoc column.
if it was not empty then i inserted the image in the item template

 Public Function chkAttachmentEmpty(ByVal strAttach As Object) As String
[u]code behind</u>

        If strAttach <> "" Then
            'chkAttachmentEmpty = "<img src='../../Common/Images/paperclip.gif' align='center'>"
            chkAttachmentEmpty = "<img src='Images/paperclip.gif' align='center'>"
        Else
            chkAttachmentEmpty = ""
        End If
    End Function


in the html i pass the dataitem as argument to that function.

<ItemTemplate>
            <%# DataBinder.Eval(Container.DataItem, "Description") %>
        </ItemTemplate>

it is working fine now

thanks everybody for their help.



 
Old July 29th, 2004, 08:48 AM
Authorized User
 
Join Date: Jul 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aravwind Send a message via Yahoo to aravwind
Default

 <%# chkAttachmentEmpty(DataBinder.Eval(Container.DataI tem, "AttachmentDoc")) %>






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with datagrid Shishir ASP.NET 1.0 and 1.1 Professional 1 January 6th, 2007 09:01 AM
Datagrid Problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 1 December 5th, 2006 03:09 AM
DataGrid Problem anujrathi VB.NET 2002/2003 Basics 2 June 15th, 2006 02:18 AM
DataGrid Problem anujrathi ASP.NET 2.0 Basics 1 June 12th, 2006 03:52 PM
Datagrid problem dotnetprogrammer VS.NET 2002/2003 1 February 17th, 2005 05:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.