Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
1.00/5 (8 votes)
See more:
My code is -
C#
thisRow += "<table><tbody><tr><td align="right" nowrap=""><input id='txtAmt'  runat="server" type='text' MaxLength='18' Style='text-align: right; Width:140px'/></td></tr></tbody></table>";

This is the code which I wrote in .cs page here one input tag is here but m not able to find the ID.
Posted
Updated 14-Nov-11 23:27pm
v2
Comments
Smithers-Jones 15-Nov-11 5:27am    
There is a little word called please. Your subject line looks pretty demanding.
Anuja Pawar Indore 15-Nov-11 8:38am    
Agree my 5. Wish i could give you
RaisKazi 15-Nov-11 5:29am    
Don't you think your Title of Question is rude?
Timberbird 15-Nov-11 5:56am    
1. You don't provide the code necessary to help you.
2. I'm not an expert, but I could help.
3. I won't. I don't like the header. I don't like your attitude. I don't like your behaviour (including shouting and deleted solution). Solve your problems yourself, be it wrong code, ignorance or rudeness

This code doesn't make any sense at all:

C#
thisRow += "<table><tbody><tr><td align=\"right\" nowrap=\"\"><input id='txtAmt'  runat=\"server\" type='text' MaxLength='18' Style='text-align: right; Width:140px'/></td></tr></tbody></table>";


The input HTML tag has an attribute runat="server", but this attribute only makes sense to the part of the compiler which compiles the markup inside the .aspx files. Your HTML code is being constructed in the code behind file and will most probably be sent back to the client's browser. The compiler will never see this tag since it's not in an aspx markup file. Thus there won't be a txtAmt object available in the code behind.

The next thing is that you haven't properly escaped the double quotes that are supposed to be in the string you're assembling.

Best Regards,

—MRB
 
Share this answer
 
v3
There's quite a lot wrong with that. Attribute values need double quotes rather than single, and the "server" needs escaping.
 
Share this answer
 
Comments
dubeyanshul1 15-Nov-11 5:34am    
READ THE CODE CAREFULLY
Smithers-Jones 15-Nov-11 5:38am    
You don't have to shout. You seem to be a very rude and impolite individual.
the string seems not propper one... try the following... (include all internal keywords in single quote, runat='server' too)

C#
thisRow += "<table> <tbody> <tr> <td align="right" nowrap="nowrape"> <input id='txtAmt'  runat="server" type='text' maxlength='18' style='text-align: right; Width:140px' /> </td> </tr> </tbody> </table>";


mark as answer if solves your problem :)
 
Share this answer
 
v2
Comments
fjdiewornncalwe 15-Nov-11 11:03am    
There is so much wrong with this I won't even start with correcting it.

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