Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have given new label inside the gridview..I have assign this label ID in javascript to get the value...

Then I need to get this value in C# when inserting or updating the gridview..
So I have given label in C# like shown below
Label labelimg = ((Label)row.FindControl("lblmenuimg"));
               string imagepath = labelimg.Text;


When I run this project the "labelimg.Text" shows null value..

Regards
vivek
Posted
Updated 25-Jul-12 6:12am
v2
Comments
santosha epili 25-Jul-12 11:22am    
what is 'row' object in your code
Nueman 25-Jul-12 12:13pm    
Minor corrections in grammar
fjdiewornncalwe 25-Jul-12 15:11pm    
does your lblmenuimg element have the runat="server" attribute defined?
Nandakishore G N 26-Jul-12 7:14am    
why do u want to use labelid in javascript?

You should both post code, and tag your question properly ( it's an ASP.NET question ). If you insert something in to a page using javascript, I don't think the server can see it. I think you need to have a hidden field that you use to store the details of anything you inserted, to read it in a postback.
 
Share this answer
 
Try This One
C#
Label lbl = (Label)GridView1.Rows[rowindex].FindControl("Label1");

and where ever you want label value use lbl.text...

good luck
 
Share this answer
 
v2

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