telur13 Posted September 7, 2007 Posted September 7, 2007 (edited) Hi there, i'm kinda new to ASP.net here the prob, i want to retrieve data from database but inside the table that i create. Normally <script> xtreme </script> i put it on the upper part, but now i want to split it up. [highlight=asp] <script language=c# runat=server debug=true> void Page_Load (object sender, EventArgs e) { *//retrieve data but now the placing takes prob * Response.Write("haha"); -> is executed i saw the result } </script> /////////////////////////// now inside the body.. ////////////////////////// <html> *//i got table create here. i want to put the data that i retrieve inside here * <script> Response.Write("haha"); </script> -> got no result at all * </html> [/highlight] if i put <%Response.Write("haha");%> it works!! guys any idea? Edited September 7, 2007 by PlausiblyDamp Quote
Administrators PlausiblyDamp Posted September 7, 2007 Administrators Posted September 7, 2007 My initial thought would be to avoid using Response.Write directly from the html markup ;) Could you not use a literal control within the markup and assign a value to it from the Page_Load event instead? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
MrPaul Posted September 7, 2007 Posted September 7, 2007 Why not use <% %>? if i put <%Response.Write("haha");%> it works!! Why not just use the <% %> tags then? As far as I know they have the same effect. Incidentally, your later <script> tags may not be working since you did not specify the runat and language attributes. Quote Never trouble another for what you can do for yourself.
telur13 Posted September 7, 2007 Author Posted September 7, 2007 well what do you mean with literal control? Table A ----------- | | | ----------- | X | | ----------- here is my problem, suppose i want to show the data from database in X mark position. I create a table then the coding of retrieving data is on the upper part then the result, data will be shown above the table, i try to put the code (split it up) it on the X mark still can not work. oh ya.. <% %> i use it for trapdoor only. ^^ <script> part actually has had complete attributes <- lol Quote
Administrators PlausiblyDamp Posted September 8, 2007 Administrators Posted September 8, 2007 ASP.Net provides a control for just this sort of thing - the Literal . Position it within the HTML markup where you want the value to go and just assign the appropriate sting to it's .Text property from your .Net code. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.