如何在Javascript中给出if else,以便根据gridview ID显示不同的网格视图 [英] How to give if else in Javascript for displaying different gridviews basing on the gridview ID

查看:78
本文介绍了如何在Javascript中给出if else,以便根据gridview ID显示不同的网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用的javascript冻结了gridview的标题并使主体滚动。我有两个网格1.MainGrid 2.ErrorGrid



在页面加载MainGrid网格视图是可见的,在用错误数据更新主网格视图时,ErrorGrid是可见的



我想写如果其他条件如此,如果Maingrid可见我的javascript应该应用于该网格,反之亦然。



The javascript which I am using freezes the header of the gridview and makes the body to scroll.I have two grids 1.MainGrid 2.ErrorGrid

On pageload the MainGrid gridview is visible and on updating the main gridview with wrong data, ErrorGrid is visible

I want to write if else condition such that if the Maingrid is visible my javascript should be applied for that grid and viceversa.

var GridId = "<%=MainGrid.ClientID %>";
var ScrollHeight = 270;
window.onload = function () {
var grid = document.getElementById(GridId);
var gridWidth = grid.offsetWidth;
var gridHeight = grid.offsetHeight;







我可以动态地给出GridID,即当特定的gridview可见时我应该将可见的GridID传递给javascript吗?



谢谢。




Can I give the GridID dynamically i.e. when the particular gridview is visible I should pass the visible GridID to the javascript?

Thanks.

推荐答案

这篇关于如何在Javascript中给出if else,以便根据gridview ID显示不同的网格视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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