473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to give gridview cell spacing?

8
we are working in grid view
in one grid each cell have childgrids and that child grid each cell contains 7 colmns and that 7 columns bind data from database but the cell spacing is not equal.


here i attached my code and source code

plz give me any suggestions...
Attached Files
File Type: zip New Folder.zip (5.8 KB, 106 views)
Aug 17 '10 #1
2 2463
MrMancunian
569 Expert 512MB
I'm not going to download files with code. You can post all relevant code in CODE-tags in your reply.

Steven
Aug 17 '10 #2
bbaamm
8
Expand|Select|Wrap|Line Numbers
  1. Protected Sub btnClass1Rev_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClass1Rev.Click
  2.  
  3.         conn.Open()
  4.  
  5.         da = New OracleDataAdapter("Select distinct hqcs_plazano from hq_plazasetup HQ_ENTRY where " & _
  6.                   "hqcs_plazatype = 'ENTRY' or hqcs_plazatype = 'EXIT' or hqcs_plazatype = 'MIXED' or hqcs_plazatype = 'OPEN' order by hqcs_plazano asc", OraCon2)
  7.         da.Fill(ds)
  8.  
  9.         GridView1.DataSource = ds
  10.         GridView1.DataBind()
  11.  
  12.         For i As Integer = 0 To GridView1.Rows.Count - 1
  13.             Dim myTemplateField As New TemplateField()
  14.             Dim lblCol As Label = DirectCast(GridView1.Rows(i).Cells(0).FindControl("lbl"), Label)
  15.             myTemplateField.HeaderText = lblCol.Text
  16.             myTemplateField.ItemTemplate = New DynamicGridTemplate("GridView" & (i + 2))
  17.  
  18.             GridView1.Columns.Add(myTemplateField)
  19.             GridView1.DataBind()
  20.  
  21.         Next
  22.  
  23.         Dim header As Integer = 0
  24.         For i As Integer = 0 To GridView1.Rows.Count - 1
  25.             Dim lblrow As Label = DirectCast(GridView1.Rows(i).Cells(0).FindControl("lbl"), Label)
  26.             For j As Integer = 1 To GridView1.Columns.Count - 1
  27.                 Dim ds1 As New DataSet()
  28.                 Dim value As Integer = Convert.ToInt32(GridView1.Columns(j).HeaderText)
  29.                 da = New OracleDataAdapter("SELECT distinct hqtf_SPfareamt1 as FA, hqtf_SPVatAmt1 as SV,hqtf_SPfareamt1 + hqtf_SPVatamt1 AS T1,hqtf_OriginSPFareamt1 as OA,hqtf_OriginSpVatamt1 as OSV,hqtf_OriginSPFareamt1 + hqtf_OriginSpVatamt1 AS T2,hqtf_SPfareamt1+hqtf_SPVatAmt1+ hqtf_OriginSPFareamt1 + hqtf_OriginSpVatamt1 as GT FROM HQ_TollFare where HQTF_Plazano = " & lblrow.Text & " and HQTF_OriginPlaza= " & value, OraCon2)
  30.                 da.Fill(ds1)
  31.                 'Dim table As New DataTable()
  32.  
  33.                 'a function that fills the datatable
  34.                 'If ds1.Tables.Count = 0 Then
  35.                 '    Dim row As DataRow = ds.Tables("HQ_TollFare").NewRow()
  36.                 '    row(0) = "none"
  37.                 '    ds1.Tables("HQ_TollFare").Rows.Add(row)
  38.                 'End If
  39.                 Dim grd As GridView = DirectCast(GridView1.Rows(i).Cells(j).FindControl("GridView" & (j + 1)), GridView)
  40.                 grd.DataSource = ds1
  41.  
  42.                 'If ds1.Tables(0).Rows.Count > 0 And header = 0 Then
  43.                 '    grd.ShowHeader = True
  44.                 '    header = header + 1
  45.                 'Else
  46.                 '    grd.ShowHeader = False
  47.                 'header = header + 1
  48.                 'End If
  49.                 If i <> 0 Then
  50.                     grd.ShowHeader = False
  51.  
  52.                 Else
  53.                     grd.ShowHeader = True
  54.                 End If
  55.                 grd.DataBind()
  56.  
  57.             Next
  58.         Next
  59.     End Sub
  60.  
  61. End Class
  62.  
  63.  

-------------------------------

source code:-


Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
  2.         <Columns>
  3.             <asp:TemplateField HeaderText="Entry/Exit">
  4.                 <ItemTemplate>
  5.                     <%--<asp:Label ID="lbl" runat="server"></asp:Label>--%>
  6.                     <asp:Label ID="lbl" runat="server" Text='<%#Eval("hqcs_plazano").ToString()%>'></asp:Label>
  7.                 </ItemTemplate>
  8.             </asp:TemplateField>
  9.         </Columns>
  10.     </asp:GridView>
  11.  
Aug 17 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Ryan | last post by:
I am not a web programmer and trying to figure out the best way for laying out a form for data entry. I would like, for example, to have a right justified label followed by 5 pixals and a left...
2
by: Terry Olsen | last post by:
I'm using a Datagrid to display my data. I want to increase the cell spacing of the grid, but when I do, if a cell is empty, there is no border drawn for that cell. I tried just entering a 'space'...
1
by: NH | last post by:
ANy ideas on how to acheive this? I want to display a dynamically created image when a mouse over occurs on a gridview event. I need some way of creating the image (it will be a small chart type...
0
by: Mike P | last post by:
I have a number of colours in a database linked to different conditions, and this data is displayed in a gridview. I want to set the BackColor of a gridview cell dependent upon this value, for...
10
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I understand how to connect a SqlDataSource to a GridView and have a nice data-connected, paginated web page generated with virtually no coding. Starting from that base, I would like to add an...
2
by: =?Utf-8?B?R3JlZw==?= | last post by:
Is there a way to set the horizontal cell spacing or padding of a gridview without setting the vertical spacing/padding? I'd like to be able to put some space between the columns without putting...
1
by: Vyas111111 | last post by:
Hello All, How can i get the value of a gridview cell outside any GridView event
5
by: =?Utf-8?B?U2F2dm91bGlkaXMgSW9yZGFuaXM=?= | last post by:
Can I set the Enabled or Visible properties of the controls (textboxes, checkboxes) displayed by default in edit mode, depending on the value of some other column? Or must I convert the column to a...
2
by: renuami | last post by:
We have a GridView2 in GridView1 EditTemplate. And we have a button (commandname="Update") on GridView2. When Button1 is clicked GridView1 goes into edit mode and displays GridView2. Now when...
2
by: yahshuatwo | last post by:
How can you display an icon the gridview cell column which is dependent on the text value of an adjacent column. Also, I setup the asp template,item and image controls, do i need to set the imgURL...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.