动态表的高度不为100%. [英] Dynamic table not taking 100% height.

查看:52
本文介绍了动态表的高度不为100%.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在gridview的项目模板中有一个服务器端表.
我正在网格Row DataBound事件中创建表行和单元格,并将其添加到该表中.
问题在于表格高度等于td文本的高度.但是我希望表格高度等于gridview单元格的高度.


请帮忙


来源

Hi all,

I have a server side table in item template of gridview.
I am creating table rows and cells in grid Row DataBound event and adding it to that table.
The problem is that the table height is equal to height of td text. But i want table height to be equal to the height of cell of gridview.


Please help


Source

<asp:TemplateField HeaderText="Load port">
                    <ItemTemplate>
                        <table runat="server" id="tblLoadPort" style="height:100%" >
                        </table>
                    </ItemTemplate>
                    <ItemStyle Width="150px" Height="100%"/>
                    <HeaderStyle VerticalAlign="Middle" HorizontalAlign="Left" Font-Size="Small" />
                </asp:TemplateField>




代码




Code

HtmlTable tblLoadPort = (HtmlTable)e.Row.Cells[6].FindControl("tblLoadPort");
                
               System.Web.UI.HtmlControls.HtmlTableRow Tr = new HtmlTableRow();
                HtmlTableCell Tc = new HtmlTableCell();
                Tc.InnerText ="Some Text";
                if (CargoWiseDetails[e.Row.RowIndex].LoadPort_SOFStatus_Details != null & CargoWiseDetails[e.Row.RowIndex].LoadPort_SOFStatus_Details.Count > 0)
                {
                    Tc.Attributes.Add("class", PresentationUtils.FillLegend(CargoWiseDetails[e.Row.RowIndex].LoadPort_SOFStatus_Details[0].SOFStatus));
                }
                else
                {
                    Tc.Attributes.Add("class", "cssGray");
                }
                Tr.Cells.Add(Tc);                

                tblLoadPort.Rows.Add(Tr);

推荐答案



根据您的要求尝试此行.

Hi,

Try this line for your requirement.

<table width="100%" height="970" bgcolor="blue">

    </table>



如果您提到height属性的百分比,则在某些浏览器中将无法使用.

为了更好,您可以给像素提供适合所有浏览器的像素


最好.



If you mention percentages in height property it won''t work in some browsers.

For better you can give pixel it can suits every browser


All the best.


只有您可以设置%的宽度.
如果您想将高度设置为100%.
您需要通过java脚本并根据Table或div的设置权重找到客户端计算机分辨率....
only u can set width of %.
If u want to set height in 100%.
u need to find Client Computer resolution by java script and according to set weight of Table or div....


这篇关于动态表的高度不为100%.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆