Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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
C#
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;
}


now issue is javascript is not working.Please tell how should use javascript.
Posted
Updated 29-Apr-10 20:34pm
v2

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 wrote:
input type='button' onClick='setvisible(sub2,none)'


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.

:)
 
Share this answer
 
Why you are doing it from code behind?you can directly add it in HTML.Also you are not closing your table element.
 
Share this answer
 
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,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900