vb.net 如何使用vb代码在asp.net中设置div的大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14995861/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 12:26:38  来源:igfitidea点击:

How to set the size of div in asp.net using vb code

asp.netvb.nethtml

提问by Hanlet Esca?o

setting the size of div in HTML:

在 HTML 中设置 div 的大小:

height: 1000px;

Is it possible to set the size of a div in asp.net using vb code? what i mean is how can i put a mark up language in a vb code

是否可以使用 vb 代码在 asp.net 中设置 div 的大小?我的意思是如何在 vb 代码中添加标记语言

回答by Hanlet Esca?o

First off if you want to access the Divfrom your code behind you've gotta make sure it has the runat="server"and ID="SomeID"attributes set, then you can access it from code behind like any other Asp.Net control.

首先,如果您想Div从后面的代码访问 ,则必须确保它设置了runat="server"ID="SomeID"属性,然后您可以像任何其他 Asp.Net 控件一样从后面的代码访问它。

Markup:

标记:

<div runat="server"  id="myDiv"></div>

VB.Net

VB.Net

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        myDiv.Attributes.Add("style", "height:1000px")
End Sub