Hi I have a simple aspx file with 2 text boxes and an ajax autocomplete extender attached to textbox2
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test4.aspx.vb" Inherits="test4" %>
<%@ 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">
<body>
<form id="form1" runat="server">
<div id="content">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server">
</asp:TextBox><br />
<asp:TextBox ID="TextBox2" runat="server">
</asp:TextBox>
</div>
<asp:AutoCompleteExtender ID="load_textBox2" TargetControlID="TextBox2" ServiceMethod="GetModelName"
UseContextKey="True" runat="server">
</asp:AutoCompleteExtender>
</form>
</body>
</html>
What i am trying to do is to call the pagemethod "GetModelName" form the aspx.vb to fillup the textbox2 with the relevent data This is the aspx.vb code
Imports System.Web.Services
Partial Class test4
Inherits System.Web.UI.Page
Dim Model_Name_old As String()()
Dim mod_code As String()
Dim mod_name As String()
Dim cod_upper As Integer
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
//calling webservice that retunrs a jagged array
Dim ins As New localhost_insert_model.dbModel
Model_Name_old = ins.get_Model_Name("A")
mod_code = Model_Name_old(0)
mod_name = Model_Name_old(1)
cod_upper = Model_Name_old(0).GetUpperBound(0)
End Sub
<WebMethod()>
Public Function GetModelName() As String()
Return mod_name
End Function
End Class
This not working.. How can i make it work???.
Your function should be shared:
<WebMethod()>
Public Shared Function GetModelName() As String()
Return mod_name
End Function
Check that EnablePageMethods="true"
in the script manager tag.