Click here to Skip to main content
13,089,943 members (45,609 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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
Updated 19-Feb-13 2:28am
ryanb31 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 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 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
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(){

<input type="button" id="btnSetValue" value="Set Value" onclick="setValue();" />

protected void page_load(object sender, EventArgs e)
      lblData.Text = string.empty;

access this property from a button event handler
protected void btnSave_Clicked(object sender, EventArgs e)
     string value = lblData.Text;

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2017
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