Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases 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 26th, 2004, 10:06 PM
Authorized User
 
Join Date: Jun 2004
Location: Drg, Drg, Malaysia.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Manage data row by row in datagrid

Hi, I am trying to select specific data that should be assigned row by row, such as now that, I am having a datagrid like below:

CHEMICAL CODE NO. MANUFACTURER AREA USED
ARGON GS0001AA Malaysian Oxygen Berhad AM1 DA LAB
ARGON GS0001AA Malaysian Oxygen Berhad AM1 FASL ASSEMBLY (FOL)
ARGON GS0001AA Malaysian Oxygen Berhad AM1 FASL MOLD
ARGON GS0001AA Malaysian Oxygen Berhad AM1 GAS STORAGE AREA
BUEHLER FS0025AA Buehler, Ltd AM1 EPOXY CLEANING ROOM
BUEHLER FS0025AA Buehler, Ltd AM2 DA LAB
.....
.....
.....


I wish to change it into a style like this:

CHEMICAL CODE NO. MANUFACTURER AREA USED
ARGON GS0001AA Malaysian Oxygen Berhad AM1 DA LAB
                                             AM1 FASL ASSEMBLY (FOL)
                                             AM1 FASL MOLD
                                             AM1 GAS STORAGE AREA
BUEHLER FS0025AA Buehler, Ltd AM1 EPOXY CLEANING ROOM
                                             AM2 DA LAB
.....
.....
.....

The data is sort by "CHEMICAL", I am trying to figure out what method should I use so that the redundant data can be "checked" and return as "null" value, so no matter which field is sorted by, once the data is redundant should not be shown. This is a report to the end-user.

Thanx for ur help in advance.

 
Old July 27th, 2004, 01:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

What is the frontend you use?

_________________________
- Vijay G
Strive for Perfection
 
Old July 27th, 2004, 02:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

You may even be able to do it in the front-end, where using the ItemDataBound or ItemCreated events (since it goes row by row), do this:

- if the current results are the same as the values stored in variables
- set the cells to a blank value.
- store the values in variables

The first time it comes through, the variables are blank. Then do the calculation, since they aren't the same, the values are left alone. Then the values are stored in the variables. On the next pass through (and all other passes), if the values are the same, then set the cell to an   otherwise, leave it alone.

Brian



Brian
 
Old July 28th, 2004, 07:42 PM
Authorized User
 
Join Date: Jun 2004
Location: Drg, Drg, Malaysia.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I not quite familiar with .Net yet, is front-end a XML features? Yup yesterday I tried to figure out in the way u have stated. I din use ItemDataBound and my code are such below:

The code behind:
Function Compare(ByVal Input As String) As String
        Dim X As String
        If (X = Input.ToString()) Then
            Return "Testing"
        Else
            Return Input
            X = Input
        End If
            End Function


HTML code in the design interface:
<Columns>
<asp:TemplateColumn HeaderText="Name Of Chemical">
<ItemTemplate>
<Table Border="0">
<tr>
<td><%# Compare(DataBinder.Eval(Container.DataItem, "fldProductName") ) %>
</td>
</tr>
</Table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>

But nothing change, what have I done wrong? How to set a cell to a blank value?

 
Old July 28th, 2004, 07:44 PM
Authorized User
 
Join Date: Jun 2004
Location: Drg, Drg, Malaysia.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Arrg.. forgot to mention, I follow the coding from this page and currently I am learning about it.

http://aspnet.4guysfromrolla.com/dem.../072102-1.aspx

 
Old July 29th, 2004, 04:17 AM
Authorized User
 
Join Date: Jun 2004
Location: Drg, Drg, Malaysia.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx to ur logic guidance bmains, I solved it!!

<script language="vb" runat="server">
    Dim x As String

    Function Compare (Input As String) As String
    If (Input <> x) Then
    x = Input
    Return Input
    End If
    End Function

</script>

<Columns>
<asp:TemplateColumn HeaderText="Name Of Chemical">
<ItemTemplate>
<Table border="0">
<tr>
<td>
<%# Compare (DataBinder.Eval (Container.DataItem, "ChemicalName")) %>
</td>
</tr>
</Table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrollbar in row of Datagrid Except Header Row Theone84 ASP.NET 2.0 Professional 0 August 11th, 2008 12:10 AM
datagrid row merge mvenkatesan ASP.NET 1.0 and 1.1 Basics 0 May 1st, 2007 04:23 AM
To retrieve a row by giving row number prad_a MySQL 1 March 22nd, 2007 11:20 PM
Read a column and Search Row by Row in another col AyatKh Excel VBA 2 January 26th, 2005 12:02 PM





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