Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi All,
 
I am using jquery auto complete textbox to search Username.Also I store userID in the label by using the jquery.When I am running the application, userid will appear in the label control.But when I try to use this label.text for insertion purpose, it is showing an empty string.How can I get the label text in the aspx.cs page also..It s great pleasure to get a solution on this
 
Thanks in advance
Posted 19-Feb-13 2:27am
Edited 19-Feb-13 2:28am
v2
Comments
ryanb31 at 19-Feb-13 8:44am
   
Can you share your code? Use the improve question link and post the relevant code, both jquery and C#.
Sandeep Mewara at 19-Feb-13 9:18am
   
One cannot comment wihtout seeing what have you implemented so far. Share the related code snippet - use Improve Question to edit/update question.
Gittu Dash at 19-Feb-13 10:23am
   
Plz share code what have you used till now.
Without seeing code it'd be hard to come to any solution.

1 solution

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

Solution 1

I guess when page is postback then Label text property is overridden by page_load/page_init event. you just check it and if needed add page.IsPostBack condition before update text property.i.e
 
<script type="text/javascript">
  function setValue(){
    $("[id*=lblData]").text("100");
  } 
</script>
 
<input type="button" id="btnSetValue" value="Set Value" onclick="setValue();" />
 
protected void page_load(object sender, EventArgs e)
{
   if(!base.IsPostBack){
      lblData.Text = string.empty;
   }
}
 
access this property from a button event handler
protected void btnSave_Clicked(object sender, EventArgs e)
{
     string value = lblData.Text;
}
  Permalink  

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



Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 19 Feb 2013
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