Click here to Skip to main content
11,706,455 members (31,945 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: 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 ) ?

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;
Posted 29-Apr-13 23:34pm
Prasad Khandekar at 30-Apr-13 6:06am
If you are adding a textarea on client side using Jqury then in code behind you won't get it's reference as it will not exists. Client side addition does not triggers the server side control addition‡. Retrieve the value using Request.


1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

No need of runat="server"
Also, add name="txtImagename1"
<textarea id="txtImagename1" name="txtImagename1" rows="1" cols="50"></textarea>

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

  Print Answers RSS
0 OriginalGriff 197
1 Sergey Alexandrovich Kryukov 141
2 chainerlt 110
3 Mika Wendelius 80
4 ppolymorphe 71
0 OriginalGriff 9,070
1 Sergey Alexandrovich Kryukov 8,413
2 CPallini 5,189
3 Maciej Los 4,746
4 Mika Wendelius 3,676

Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 30 Apr 2013
Copyright © CodeProject, 1999-2015
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