Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net : Get the value from textarea

Tags:

jquery

c#

asp.net

i am creating one form for image upload drag and drop through jquery.

when i dragged one image to aspx form, that time that image preview and title ( textarea ) and desc ( textarea ) created to aspx page.

after entered the title and desc, it is saved to database when i click save button.

i couldn't get the textarea control in c# (code behind ) ?

textarea does not added directly to aspx page. it is is dynamically added through jquery so????

in jquery textarea added

<textarea id="txtImagename1" runat="server" rows="1" cols="50"></textarea>

code behind

HtmlTextArea txtImageupload = (HtmlTextArea)(frm.FindControl("txtImagename1"));
string imagename = txtImageupload.Value;
like image 872
sankara pandian Avatar asked Apr 30 '13 09:04

sankara pandian


2 Answers

Try

Request.Form["txtImagename1"]

No need of runat="server"

Also, add name="txtImagename1"

<textarea id="txtImagename1" name="txtImagename1" rows="1" cols="50"></textarea>
like image 186
Kapil Khandelwal Avatar answered Sep 28 '22 13:09

Kapil Khandelwal


Add name attribute to the Dynamic control :

 <textarea id="txtImagename1" name="txtImagename1" runat="server" rows="1" cols="50">
 </textarea>

from your codebehind :

Request.Form["txtImagename1"]
like image 36
Suave Nti Avatar answered Sep 28 '22 12:09

Suave Nti