Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: jQuery
Hi,
I am appending asp textbox to a table there but it is not appending.
It is throwing error please any one help me..........
This way I have done please find the line of code.
 $("#tbDetails").append("<table><tbody><tr><td>" + data.d[i].Field_text + "</td><td>" + ':' + "</td><td><asp:TextBox ID='txtDetails" + i + " runat="'server'" /></td></tr></tbody></table>");
It is throwing error The server tag is not well formed.
Posted 25-Nov-12 22:52pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Are you missing a single quote after txtDetails?
 
<asp:textbox id='txtDetails"+i+"'.....
  Permalink  
v3
Comments
BalaMahesh at 26-Nov-12 7:29am
   
$("#tbDetails1").append("<tr><td>" + data.d[i].Field_text + "</td><td>" + ':' + "</td><td><asp:TextBox ID='txtDetails1" + i + "' runat='server' /></td></tr>");
This way also i tried but in designer.cs file its throwing Error
Like ;Excepetced
Is it possible Asp server control(textbox) to append a table?
Jyotish Pillai at 27-Nov-12 5:20am
   
Better you tell us the requirement. We can find another way :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Try using the following and let me know ...
 
$("#tbDetails").append("<table><tbody><tr><td>" + data.d[i].Field_text + "</td><td>:</td><td><asp:TextBox ID='txtDetails" + i + "' runat='server' /></td></tr></tbody></table>");
 
NOTE: Please don't add any pre tags or edit this code.
Because it adds extra quotes and makes the code different.
  Permalink  
v2
Comments
BalaMahesh at 26-Nov-12 7:24am
   
i changed as per my requirement only but still its throwing same error and Designer.cs file also throwing build errors Expected ;
like that
Tadit Dash at 26-Nov-12 9:18am
   
Ok I will work this out and give you an update about it. Don't worry. :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

If you want textbox's value in server side then you can use it like this :
 
<div id="divBox" runat="server">
</div>
Now in the script tag append the text box as input element.
$("#divBox").append("<input type='text' id='txtDetails'/>");
on the server side get the textbox by this way:
TextBox txt = (TextBox)divBox.FindControl("txtDetails");
 
Thanks. Smile | :)
  Permalink  
Comments
BalaMahesh at 26-Nov-12 7:22am
   
$("#tbDetails").append("<tr><td>" + data.d[i].Field_text + "</td><td>" + ':' + "</td><td><input id='txtDetails" + i + "' type='text' /></td></tr>");
above way i done that.
HTML textbox its working fine but i want that text box value in server side.thats why i am changing again that HTML textbox to asp.net textbox
Please give me any alter native solution
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

jQuery works with the HTML DOM. So, you can not create any server side control using jQuery. You can only create html controls using jQuery.
 
If you want the value of the txtDetails,You can make javascript function to get value of that txtbox and then call that javascript function in your code-behind.
 

Hope that helps.
  Permalink  

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

  Print Answers RSS
0 DamithSL 400
1 Maciej Los 217
2 OriginalGriff 213
3 BillWoodruff 130
4 Zoltán Zörgő 85
0 OriginalGriff 7,953
1 DamithSL 6,139
2 Sergey Alexandrovich Kryukov 5,449
3 Maciej Los 5,293
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100