Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I have used datalist to display data from the table. In each record there is textbox and save button. When user enter data in textbox and click save, the data should be inserted in other table with the id of that row as foriegn key. But, when I take the value of textbox in another variable, the nullreferrenceexception occurs. I write following line to check the value of textbox.
C#
Label1.Text=((Label)dlProductBasedSales.FindControl("lblIProductId")).Text;

What is wrong? Suggest me the solution.
Posted
Comments
DamithSL 26-Jun-15 1:28am    
try with
dlProductBasedSales.SelectedItem.FindControl("lblIProductId")
Dolly Nimavat 26-Jun-15 11:09am    
I tried it. Still the same error

1 solution

 
Share this answer
 
Comments
Dolly Nimavat 26-Jun-15 13:19pm    
Thanks...

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