asp.net中的innerHtml属性 [英] innerHtml property in asp.net

查看:483
本文介绍了asp.net中的innerHtml属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想创建一个报告,其中将显示客户名称,订单ID和详细信息
当客户单击详细信息时,应打开细分或表格.

为此我喜欢

Hi,
I want to create a report that will show customer name , order id , details
When customer click on detail then sub div or table should open.

For this I did like

protected void Page_Load(object sender, EventArgs e)
{
string html="";
html="<table><tr><td>Customer Name</td><td><input type='button' onClick='setvisible(sub2,none)' </td></tr>";
html+="<tr><td> <div id='sub3'> Details </div> </td></tr>";

divCusr.innerHtml=html;
}



现在问题是javascript无法正常工作.请告诉您应该如何使用javascript.



now issue is javascript is not working.Please tell how should use javascript.

推荐答案



令人沮丧的是,当人们为您提供帮助时,您可能没有正确阅读答案就拒绝了他们的回答.有时人们可能无法给出您的确切答案(提供确切答案也取决于问题声明/问题的发布方式).

我告诉你的是什么错事或根本没有道理? :doh:

(1)请检查您的代码,

Hi

This is frustrating that when people helps you, you downvoted their answer without properly reading the answer probably. Sometime people might not be able to give your exact answer (providing exact anwer also depends on how the prolem statement/question has been posted though).

What I told you was that anything wrong or does not that make sense at all? :doh:

(1)Check your code please,

Seema Gosain写道:
Seema Gosain wrote:

input type ="button''onClick ="''setvisible(sub2,none)''

input type=''button'' onClick=''setvisible(sub2,none)''



形成HTML时未正确关闭它.

(2)我在提早请求时使用了您的代码,并在出现错误消息后编译您的代码后发现

" System.Web.UI.HtmlControls.HtmlGenericControl不包含" innerHtml的定义."

我发现正确的属性名称应为divCusr元素的"InnerHtml".

有时您可能会在论坛中获得有关您的目标和确切解决方案的好提示.

如果您对任何帖子都不满意,请等待更多帖子出现,然后不要不必要地投票.如果这样做,最终人们可能会停止回答您的问题.

:)



It is not correctly closed while forming the HTML.

(2) I used your code while anwering earlier and I found after compiling your code following error message

"''System.Web.UI.HtmlControls.HtmlGenericControl'' does not contain a definition for ''innerHtml''".

I found that correct property name should be "InnerHtml" for divCusr element.

Sometime you might get good hints towards your goal and sometime exact solution in a forum.

If you are not satisfied with any post, wait for some more to appear, and please dont downvote un-neccessary.if you do that, eventually people might stop responding to your question.

:)


为什么要从后面的代码中进行操作?您可以直接在HTML中添加它.而且,您也不必关闭表格元素.
Why you are doing it from code behind?you can directly add it in HTML.Also you are not closing your table element.




我注意到的几件事,

(1)您的输入类型控件未正确关闭.请更正要尝试生成的HTML.

(2)在HTML中用runat = server声明的div元素在后面的代码中没有名为"innerHtml"的属性.我猜这是一个错字,应该更正为"InnerHtml".

希望对您有帮助
Hi,

Couple of things I have noticed ,

(1) Your input type control is not closed properly. Please correct the HTML that you are trying to generate.

(2) A div element which is declared with runat=server in HTML, does not have a property named "innerHtml" in code behind. I guess that is a typo and corrected should be "InnerHtml".

Hope that helps you,


这篇关于asp.net中的innerHtml属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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