Hi rakeshkuma,
You need to call the UpdatePanle Update() method.
Check this example. Now please take its reference and correct your code.
Database
For this example I have used of Northwind database that you can download using the link given below.
Download Northwind Database
HTML
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<section class="container-fluid title-overlay" style="background-color: #949494; color: #ffffff">
<div class="container">
<div class="row">
<div class="col-sm-12">
<h3 style="margin-top: 10px; margin-bottom: 10px;">Create Purchase Order
<br />
<br />
<a href="javascript:history.go(-1)" class="" style="font-size: 10px; letter-spacing: 1px; vertical-align: middle; color: #ffffff"><i class="fa fa-chevron-left"></i> BACK</a>
</h3>
</div>
</div>
</div>
</section>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<form id="sendform" method="post" action="#" runat="server">
<section class="container-fluid block location-block">
<div class="container">
<ajax:ToolkitScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="SCPanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<asp:Panel ID="PanelPOLineItem" runat="server">
<div id="container">
<div class="row" id="gw_poitem_details">
<div class="col-sm-6">
<div class="header" style="">
<label style="font-size: 11px; margin-bottom: 0px; letter-spacing: 1px; text-transform: uppercase;">Item Code </label>
<br>
<asp:TextBox ID="gw_txtitem" runat="server" CssClass="form-control" AutoCompleteType="none" Style="width: 100%; margin-top: 5px" AutoPostBack="True" OnTextChanged="get_item_details"></asp:TextBox>
<ajax:AutoCompleteExtender ID="AutoCompleteExtender2" runat="server" FirstRowSelected="true" TargetControlID="gw_txtitem" CompletionListCssClass="AutoExtender"
CompletionListItemCssClass="AutoExtenderList" CompletionListHighlightedItemCssClass="AutoExtenderHighlight" MinimumPrefixLength="1" EnableCaching="true"
CompletionSetCount="1" CompletionInterval="100" ServiceMethod="GetOrderNo">
</ajax:AutoCompleteExtender>
</div>
<div class="header" style="">
<label style="font-size: 11px; margin-bottom: 0px; letter-spacing: 1px; text-transform: uppercase;">Description </label>
<br>
<asp:TextBox ID="txtdsca" runat="server" CssClass="form-control" AutoCompleteType="none" Style="width: 100%; margin-top: 5px"></asp:TextBox>
</div>
<div class="header" style="">
<label style="font-size: 11px; margin-bottom: 0px; letter-spacing: 1px; text-transform: uppercase;">Date </label>
<br>
<asp:TextBox ID="TextBox1" CssClass="form-control flatpickrddat" ReadOnly="true" runat="server" />
</div>
<div class="header" style="">
<label style="font-size: 11px; margin-bottom: 0px; letter-spacing: 1px; text-transform: uppercase;"> </label>
<br>
<asp:LinkButton ID="btnAddInGrid" runat="server" CssClass="btn btn-primary btn-xs" Style="margin-top: 10px;" OnClick="btnAddInGrid_Click"> <i class="fa fa-plus-square"></i> ADD </asp:LinkButton>
</div>
</div>
<div class="col-sm-12">
<asp:Label ID="lblvalue" runat="server"></asp:Label>
</div>
</div>
</div>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAddInGrid" />
</Triggers>
</asp:UpdatePanel>
</div>
</section>
</form>
</asp:Content>
Namespaces
C#
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Script.Services;
using System.Web.Services;
VB.Net
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Script.Services
Imports System.Web.Services
Code
C#
[ScriptMethod()]
[WebMethod]
public static List<string> GetOrderNo(string prefixText)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conString"].ToString());
SqlCommand cmd = new SqlCommand("SELECT ContactName FROM Customers WHERE ContactName LIKE @SearchText + '%'", con);
cmd.Parameters.AddWithValue("@SearchText", prefixText);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
List<string> getorderdel = new List<string>();
for (int i = 0; i <= dt.Rows.Count - 1; i++)
{
getorderdel.Add(dt.Rows[i]["ContactName"].ToString());
}
return getorderdel;
}
protected void get_item_details(object sender, EventArgs e)
{
GetItemDet(gw_txtitem.Text);
}
private void GetItemDet(string itemcode)
{
string constr = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
SqlCommand com = new SqlCommand("SELECT * FROM Customers WHERE ContactName = @query", con);
com.Parameters.AddWithValue("@query", itemcode);
SqlDataAdapter da = new SqlDataAdapter(com);
var ds = new DataSet();
da.Fill(ds);
var dt = ds.Tables[0];
con.Close();
if (dt.Rows.Count > 0)
{
txtdsca.Text = dt.Rows[0]["ContactTitle"].ToString().Trim();
SCPanel1.Update();
}
}
protected void btnAddInGrid_Click(object sender, EventArgs e)
{
lblvalue.Text = "Record Submitted !!";
}
VB.Net
<ScriptMethod()>
<WebMethod>
Public Shared Function GetOrderNo(ByVal prefixText As String) As List(Of String)
Dim con As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("conString").ToString())
Dim cmd As SqlCommand = New SqlCommand("SELECT ContactName FROM Customers WHERE ContactName LIKE @SearchText + '%'", con)
cmd.Parameters.AddWithValue("@SearchText", prefixText)
Dim da As SqlDataAdapter = New SqlDataAdapter(cmd)
Dim dt As DataTable = New DataTable()
da.Fill(dt)
Dim getorderdel As List(Of String) = New List(Of String)()
For i As Integer = 0 To dt.Rows.Count - 1
getorderdel.Add(dt.Rows(i)("ContactName").ToString())
Next
Return getorderdel
End Function
Protected Sub get_item_details(ByVal sender As Object, ByVal e As EventArgs)
GetItemDet(gw_txtitem.Text)
End Sub
Private Sub GetItemDet(ByVal itemcode As String)
Dim constr As String = ConfigurationManager.ConnectionStrings("conString").ConnectionString
Dim con As SqlConnection = New SqlConnection(constr)
Dim com As SqlCommand = New SqlCommand("SELECT * FROM Customers WHERE ContactName = @query", con)
com.Parameters.AddWithValue("@query", itemcode)
Dim da As SqlDataAdapter = New SqlDataAdapter(com)
Dim ds = New DataSet()
da.Fill(ds)
Dim dt = ds.Tables(0)
con.Close()
If dt.Rows.Count > 0 Then
txtdsca.Text = dt.Rows(0)("ContactTitle").ToString().Trim()
SCPanel1.Update()
End If
End Sub
Protected Sub btnAddInGrid_Click(ByVal sender As Object, ByVal e As EventArgs)
lblvalue.Text = "Record Submitted !!"
End Sub
Screenshot