immediate display of text after entering the data in text box?

Posted by Tejamanimala under ASP.NET on 10/26/2013 | Points: 10 | Views : 1062 | Status : [Member] | Replies : 5
Hi,i have one text bo,when i enter the uder id in textbox,i want to display the name beside the textbox,how it is possible can any one help me?actually i have used ontextchanged event for this,but when i enter the userid in text box immeadiatly name is not displayed.when i clik the mose outside of the text box it is diaplying the name,but i want to display immediatly...like

if i enter 1002 as a userid in textbox,after entering last no 2,immeadiatly i want to display the name beside the textbox,can any one help me how it is possible?

manimala


Responses

Posted by: Nismeh on: 10/28/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

For this please ensure that you are using Ajax control - Update Panel. And than set minimum no of characters to fire and event.

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Tejamanimala, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 10/28/2013 [Member] Starter | Points: 25

Up
0
Down
Also confirm that you've set auto post back property true


IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Tejamanimala, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Tejamanimala on: 10/28/2013 [Member] Starter | Points: 25

Up
0
Down
actually i was displaying some payroll details based on this textbox(empid),so i have used ontext_changed event for this.and i put autopost back is true.when i use the update panel it is not working,can you please see this code,,,
source code is...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="paydescription.aspx.cs" Inherits="pay_description.paydescription" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type = "text/javascript">
$(function () {
$('#<%= txtEmpid.ClientID %>').keyup(function () {
$('#<%= Label4.ClientID %>').text($('#<%= txtEmpid.ClientID %>').val());
});
});

</script>
<style type="text/css">
.style1
{
color: #FF9900;
font-size: x-large;
}
.style2
{
width: 86%;
height: 175px;
margin-top: 4px;
margin-left: 0px;
}
.style5
{
color: #0000CC;
font-size: large;
}
.style14
{
width: 124px;
}
.style17
{
color: #6600CC;
text-align: center;
}
.style21
{
color: #0000CC;
font-size: large;
width: 204px;
}
.style22
{
width: 200px;
}
.style23
{
color: #FF00FF;
font-size: x-large;
}
.style25
{
width: 344px;
}
.style26
{
font-size: large;
color: #FF9900;
}
.style27
{
font-family: Arial;
}
.style28
{
color: #FF9900;
font-size: x-large;
font-family: Arial;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<span class="style1"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
class="style27">&nbsp;&nbsp;

WelCome&nbsp; Your ID</span></strong><span class="style27">:&nbsp;</span></span>&nbsp;
<asp:Label ID="Label1" runat="server" Font-Bold="True" Text="Label"
style="color: #FF3399; font-size: x-large; font-family: Arial;"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="style28"><strong>Your Name: </strong></span>
<asp:Label ID="lblName" runat="server" Font-Bold="True" Text="Label"
style="color: #FF3399; font-size: x-large; font-family: Arial;"></asp:Label>

<br />

<br />
<strong><span
class="style26">&nbsp;</span><span class="style1">From Date</span><span
class="style26">&nbsp;</span></strong>&nbsp;
<span class="style26"><strong>&nbsp;</strong><asp:TextBox ID="TextBox25"
runat="server"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
<span class="style1"><strong>&nbsp;&nbsp; To Date&nbsp; </strong>
<asp:TextBox ID="TextBox26" runat="server"></asp:TextBox>
</span><br />
<br />

<strong><span class="style26">&nbsp;</span><span class="style28">Emp ID </span><span class="style26">
&nbsp;</span></strong>&nbsp;&nbsp;
&nbsp;<asp:TextBox ID="txtEmpid" runat="server" AutoPostBack="True"
ontextchanged="txtEmpid_TextChanged"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong><span class="style26">&nbsp;</span><span
class="style1"> </span>
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
</strong>&nbsp;<br />

</div><center>
<asp:Panel ID="Panel1" runat="server"
Font-Bold="True" Font-Names="Arial" Font-Size="Large" ForeColor="#0000CC"
Height="353px"
style="margin-left: 0px; margin-top: 0px; text-align: center;" Width="1006px"
BackImageUrl="~/Images/Light_Blue_429604_i0.png">
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label
ID="Label3" runat="server" Font-Bold="True" Font-Italic="True"
Font-Names="Arial" Font-Size="XX-Large" Font-Underline="True"
ForeColor="#CC3399" Text="Pay Description" align="center" CssClass="style17"></asp:Label>
<br class="style17" />
<center><ta

manimala

Tejamanimala, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 10/29/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer this link
http://msdn.microsoft.com/en-us/library/ms754356.aspx

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Tejamanimala, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Samirbhogayta on: 10/29/2013 [Member] Starter | Points: 25

Up
0
Down
hi.. yes you can do this with jquery

<head>
<script type="text/javascript" language="javascript">
$(function () {
$('#<%= txt_Test.ClientID %>').keyup(function () {
$('#<%= lbl_Text.ClientID %>').text($('#<%= txt_Test.ClientID %>').val());
});
});
</script>
</head>

<body>
<asp:TextBox ID="txt_Test" runat="server"></asp:TextBox>

<asp:Label runat="server" ID="lbl_Text"></asp:Label>
</body>

SAMIR
Sr. Software Engineer

Tejamanimala, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response