Click here to Skip to main content
15,889,595 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: get same parameter twice Pin
Richard Deeming13-Jan-14 7:49
mveRichard Deeming13-Jan-14 7:49 
GeneralRe: get same parameter twice Pin
miss78614-Jan-14 5:08
miss78614-Jan-14 5:08 
GeneralRe: get same parameter twice Pin
Richard Deeming14-Jan-14 10:59
mveRichard Deeming14-Jan-14 10:59 
GeneralRe: get same parameter twice Pin
miss78628-Jan-14 6:52
miss78628-Jan-14 6:52 
QuestionWhat is the best way for managing reports in Kentico CMS 7.0 Pin
Bhushan Patki19-Dec-13 0:32
Bhushan Patki19-Dec-13 0:32 
Answertemp Pin
Ya Rasoolallah18-Dec-13 12:56
Ya Rasoolallah18-Dec-13 12:56 
SuggestionRe: temp Pin
Richard MacCutchan18-Dec-13 22:00
mveRichard MacCutchan18-Dec-13 22:00 
Questionauto complete with ajaxcontroltoolkit and ado.net Pin
Ya Rasoolallah18-Dec-13 12:01
Ya Rasoolallah18-Dec-13 12:01 
hello to all
i have a problem with the program that see in below;
this program has not any syntax error but doesn't work;
i thank you if help me.Rose | [Rose]




Default.aspx page:

C#
<%@ Page Language="C#‎‎‎‎‎‎‎‎‎" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
 
<%@ 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 runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
         
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
         
      <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
      TargetControlID="TextBox1" ServiceMethod="GetCompletionList"
      UseContextKey="True" MinimumPrefixLength="1" CompletionInterval="100" ServicePath="~/WebService.asmx">
      </asp:AutoCompleteExtender>
    </div>
    </form>
</body>
</html>


Default.aspx.cs

C#
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
 
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
}


in .asmx file

C#
<%@ WebService Language="C#‎‎‎" CodeBehind="~/App_Code/AutoComplete.cs" Class="AutoComplete" %>


in .asmx code behind file

C#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Configuration;
 
/// <summary>
/// this WebService is designed for autocomplete with ajaxControlToolkit and ADO.Net
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class AutoComplete  : System.Web.Services.WebService {
 
    public AutoComplete()
    {
 
        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }
 
    [WebMethod]
    public string[] GetCompletionList(string prefixText, int count)
    {
       
        SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
        string query = "select * from tbl_users where username like username";
        SqlCommand cm = new SqlCommand(query,cn);
        cm.Parameters.AddWithValue("username","N%"+prefixT  ext+"%");
        cn.Open();
        SqlDataReader dr = cm.ExecuteReader();
         
        List<string> Textbox1 = new List<string>();
        String dbValues;
        while (dr.Read())
        {
            //String From DataBase(dbValues)
            dbValues = dr["username"].ToString().ToLower();
            Textbox1.Add(dbValues);
         
        }
        return Textbox1.ToArray();
        cn.Close();
    }
     
} 

note:the visual studio doesn't know "Texbox1" (in asmx codbehind)

modified 18-Dec-13 18:38pm.

AnswerRe: auto complete with ajaxcontroltoolkit and ado.net Pin
thatraja18-Dec-13 13:39
professionalthatraja18-Dec-13 13:39 
GeneralRe: auto complete with ajaxcontroltoolkit and ado.net Pin
Ya Rasoolallah18-Dec-13 14:05
Ya Rasoolallah18-Dec-13 14:05 
GeneralRe: auto complete with ajaxcontroltoolkit and ado.net Pin
thatraja18-Dec-13 14:22
professionalthatraja18-Dec-13 14:22 
GeneralRe: auto complete with ajaxcontroltoolkit and ado.net Pin
Ya Rasoolallah19-Dec-13 6:10
Ya Rasoolallah19-Dec-13 6:10 
AnswerRe: auto complete with ajaxcontroltoolkit and ado.net Pin
joginder-banger25-Dec-13 15:36
professionaljoginder-banger25-Dec-13 15:36 
QuestionAre there any good "substitute" ASP.Net lessons for "C# for programmers 2e"? Pin
That New Guy18-Dec-13 10:47
That New Guy18-Dec-13 10:47 
AnswerRe: Are there any good "substitute" ASP.Net lessons for "C# for programmers 2e"? Pin
Rahul Rajat Singh19-Dec-13 18:23
professionalRahul Rajat Singh19-Dec-13 18:23 
AnswerRe: Are there any good "substitute" ASP.Net lessons for "C# for programmers 2e"? Pin
abdul subhan mohammed21-Dec-13 3:44
professionalabdul subhan mohammed21-Dec-13 3:44 
Questionpass a value from custom text box control to controller Pin
Member 1040952418-Dec-13 10:01
Member 1040952418-Dec-13 10:01 
QuestionComplex UriTemplate for WCF Pin
Siva Kumar Balaguru 18-Dec-13 0:16
Siva Kumar Balaguru 18-Dec-13 0:16 
AnswerRe: Complex UriTemplate for WCF Pin
Rahul Rajat Singh19-Dec-13 18:21
professionalRahul Rajat Singh19-Dec-13 18:21 
QuestionI want column wise gridview paging Pin
Member 1006079517-Dec-13 21:04
Member 1006079517-Dec-13 21:04 
AnswerRe: I want column wise gridview paging Pin
thatraja17-Dec-13 23:25
professionalthatraja17-Dec-13 23:25 
GeneralRe: I want column wise gridview paging Pin
Snehasish_Nandy18-Dec-13 1:37
professionalSnehasish_Nandy18-Dec-13 1:37 
GeneralRe: I want column wise gridview paging Pin
thatraja18-Dec-13 2:05
professionalthatraja18-Dec-13 2:05 
AnswerRe: I want column wise gridview paging Pin
joginder-banger25-Dec-13 15:41
professionaljoginder-banger25-Dec-13 15:41 
QuestionNew Pin
tsunamigang17-Dec-13 17:27
tsunamigang17-Dec-13 17:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.