473,320 Members | 1,883 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,320 software developers and data experts.

Need advice in setting column's width of a grid inside a repeater

Dear All:
Banckgroud: I have a datagrid which lives inside a repeater. Which is
working fine. What i need is to dyanamically set the column width of the
grid (which lieves inside the repeater). Is there any way, we accomplish
this? Any advice on this would be greatly appreciated.

Reza.

---BEGIN PART Of ListApp.aspx --->

<table>
<asp:Repeater ID="repL" DataSource='<%#
GetApplicationInfo(((RMS.Lib.DAO.Application)
Container.DataItem).ApplicationID)%>' runat="server">
<ItemTemplate>
<tr><td align="center"><%# ((RMS.Lib.DAO.Application)
Container.DataItem).Name %></td></tr>
<tr><td>

<asp:datagrid id="GridLS" DataSource='<%#
GetSGrid(((RMS.Lib.DAO.Application) Container.DataItem).ApplicationID) %>'
runat="server" ShowHeader="False" Width="100%" BorderColor="#ffffff"
EnableViewState="True"
autogeneratecolumns="false" HorizontalAlign="Center"
BorderStyle="None">
<alternatingitemstyle CssClass="datacell2"
HorizontalAlign="Center" Font-Size="smaller" />
<ItemStyle CssClass="datacell" HorizontalAlign="Center"
Font-Size="smaller" />
<Columns>
<asp:BoundColumn DataField="col1"></asp:BoundColumn>
<asp:BoundColumn DataField="col2"></asp:BoundColumn>
<asp:BoundColumn DataField="col3"></asp:BoundColumn>
</Columns>
</asp:datagrid>

</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
---END PART OF ListApp.aspx ----
---BEGIN PART OF CODE Behind ListApp.aspx.cs ----
protected DataTable GetSGrid(string id)
{

// BEGIN :: Trying to set the width of the column of the grid lives
inside the repeater
// folowing are the technique i was trying, but didn't work
// Question: is there any way we can set the width of the grid inside a
repeater?
int width1 = 5;
int width2 = 70;
int width3 = 25;
GridLS.Columns[0].ItemStyle.Width=new Unit(width1,UnitType.Percentage);
GridLS.Columns[1].ItemStyle.Width=new Unit(width2,UnitType.Percentage);
GridLS.Columns[2].ItemStyle.Width=new Unit(width3,UnitType.Percentage);
// END :: Trying to set the width of the column of the grid lives inside
the repeater

string sql = @"SELECT col1,col2,col3 FROM my_table where id="+id;
Summary s = new Summary();
DataSet ds = s.GetSiteList(sql);
DataTable gridSrouce = (DataTable) ds.Tables[0];

return gridSrouce;
}

---END PART OF CODE Behind ListApp.aspx.cs ----
Nov 19 '05 #1
0 1806

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tim Nelson | last post by:
I thought there should be simple way of setting the column width in the a DataGrid. I've set up a table style (properties tab) that lengthen the columns, but I can't seem to bind this table style...
24
by: Mike L | last post by:
This is for a Win form, in C# 2005. I want to load a datagrid, make some columns width 0, and then clean out the record I added. I get the error message, ""Index was out of range. Must be...
4
by: Emil | last post by:
Can somebody tell me what would be the syntax for having an if statement and setting the selected index of a radiobuttonlist? This is my first project using ASP.net and I use C#. I have a repeater...
6
by: cr113 | last post by:
I'm trying to set the column widths for a datagrid. You'd think it would be easy. I looked it up in google and the first thing I found looked promising: datagrid1.columns(0).width = 2000...
4
by: Grace | last post by:
I use a datagrid included in a repeater. as following: (.aspx) <asp:repeater id="rp_perform" Runat="server"> <HeaderTemplate> <table border="0" bgcolor="gray" cellspacing="0" cellpadding="0">...
4
by: Rich | last post by:
Hello, I have a one datagrid that will be based on different datatables. One datatable may have 7 columns, another 15... With the tables that have more columns, I have been manually dragging...
2
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat...
1
by: NishChaks | last post by:
Hi, I have a texbox which is a template column of a grid and the grid is inside the repeater. If there is only one control in the repeater then we can use foreach (RepeaterItem item in...
4
by: Bill McCormick | last post by:
Hello cSharpies, I'm building my 1st WPF app and I'd like to get off to a good start, so experienced advice I'm soliciting. The application is an explorer like tool with two (2) main sections:...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.