Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在它下面有gridview和图表。
我希望 gridview 根据列数(未设置宽度)进行拉伸,然后将该宽度分配给图表。
如果我做:
chart.Width = gridview.Width.Value;
我得到 0.0 像素。
它不会以这种方式工作,您需要的宽度是客户端值,您无法从服务器端获取它。尝试将调整大小图表逻辑移动到 javascript,使用表格 (gridview) 的 .offsetWidth/.clientWidth 属性。或者您可以修改标记以使图表自动拉伸(将网格和图表放入一个公共容器中并拉伸图表以填充容器的宽度)。