|
|
|
It is quite suspicious that you appear to have just signed up and your first post is not a question, which these forums are for. This is not the place for such postings, which, if you look at the rating, others agree with also.
Being new here you should be cautious and understand the rules before trying to use them. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
|
hi
my requirement is
when typing some data in textbox i want to search that data in database and show the below the textbox other wise add to listbox when any one selected in that listbox i want to show the details of that selected value.
for example i am typed 'G' in text box i want to search the 'G' related emails when any one selected the based on email id i want to show email name,address, like.....
how it is possible in asp.net 2.0
can u give me suggession
|
|
|
|
|
Use the AutoCompleteExtender like you have tried in the post directly below. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
In aspx page
I am trying like this this is not functioning.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<title>Untitled Page
<asp:scriptmanager id="ScriptManager1" enablepagemethods="true" runat="server">
<services>
<asp:servicereference path="MyAutocompleteService.asmx">
<asp:textbox id="TextBox1" runat="server">
<asp:listbox id="lstMails" visible="True" runat="Server">
<cc1:autocompleteextender id="AutoCompleteExtender1" runat="server" servicepath="MyAutocompleteService.asmx"
="" servicemethod="GetLisBox" targetcontrolid="TextBox1" minimumprefixlength="1" completioninterval="10" enablecaching="true" completionsetcount="12" completionlistcssclass="AutoExtender" completionlistitemcssclass="AutoExtenderList" completionlisthighlighteditemcssclass="AutoExtenderHighlight" completionlistelementid="lstMails">
In WedbService
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Collections.Generic;
using System.Xml;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.UI.WebControls;
///
/// Summary description for MyAutocompleteService
///
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class MyAutocompleteService : System.Web.Services.WebService
{
public MyAutocompleteService()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
public ListBox GetLisBox(string prefixText, int count)
{
ListBox lstEmail = new ListBox();
DataSet ds = new DataSet();
string conString = ConfigurationManager.ConnectionStrings["SqlOpenRopes"].ToString();
SqlConnection con = new SqlConnection(conString);
con.Open();
SqlDataAdapter da;
SqlCommand sqlCmd = new SqlCommand();
sqlCmd = new SqlCommand("SELECT ReservationId,Email FROM Reservations where email !='' AND Email Like '" + prefixText + "%'", con);
da = new SqlDataAdapter(sqlCmd);
da.Fill(ds);
if (ds != null)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
ListItem lItem = new ListItem();
lItem.Text = ds.Tables[0].Rows[i]["Email"].ToString();
lItem.Value = ds.Tables[0].Rows[i]["ReservationId"].ToString();
lstEmail.Items.Add(lItem);
}
}
con.Close();
//for (int i = 0; i < count; i++)
// responses.Add(prefixText + (char)(i + 65));
return lstEmail;
}
}
|
|
|
|
|
One, format the code you are posting using the pre tags. This is the second time you have been told this.
Two, Do not post the same question, even if you use a different title and frame it differently.
Three, Do not post the same question in multiple forums.
If you follow the rules and conventions you will get better results here. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
READ the responses!!! I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Same question as below, just asked a different way. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi
i am writing the code in aspx page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" 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:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server">
<Services>
<asp:ServiceReference Path="MyAutocompleteService.asmx" />
</Services>
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<div id="divWidth">
</div>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" ServicePath="MyAutocompleteService.asmx"
ServiceMethod="GetEmailsIdString" TargetControlID="TextBox1" MinimumPrefixLength="1"
CompletionInterval="10" EnableCaching="true" CompletionSetCount="12" CompletionListCssClass="AutoExtender"
CompletionListItemCssClass="AutoExtenderList" CompletionListHighlightedItemCssClass="AutoExtenderHighlight"
CompletionListElementID="divWidth">
</cc1:AutoCompleteExtender>
</div>
</form>
</body>
</html>
in webservice
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Collections.Generic;
using System.Xml;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
/// &lt;summary&gt;
/// Summary description for MyAutocompleteService
/// &lt;/summary&gt;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class MyAutocompleteService : System.Web.Services.WebService
{
public MyAutocompleteService()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string[] GetSuggestions(string prefixText, int count)
{
List&lt;string&gt; responses = new List&lt;string&gt;();
for (int i = 0; i &lt; count; i++)
responses.Add(prefixText + (char)(i + 65));
return responses.ToArray();
}
[WebMethod]
public string[] GetEmailsIdString(string prefixText, int count)
{
List&lt;string&gt; responses = new List&lt;string&gt;();
DataSet ds = new DataSet();
string conString = ConfigurationManager.ConnectionStrings["SqlOpenRopes"].ToString();
SqlConnection con = new SqlConnection(conString);
con.Open();
SqlDataAdapter da;
SqlCommand sqlCmd = new SqlCommand();
sqlCmd = new SqlCommand("SELECT ReservationId,Email FROM Reservations where email !='' AND Email Like '" + prefixText + "%'", con);
da = new SqlDataAdapter(sqlCmd);
da.Fill(ds);
if (ds != null)
{
for (int i = 0; i &lt; ds.Tables[0].Rows.Count; i++)
responses.Add(ds.Tables[0].Rows[i]["Email"].ToString());
}
con.Close();
//for (int i = 0; i &lt; count; i++)
// responses.Add(prefixText + (char)(i + 65));
return responses.ToArray();
}
}
when running this code is executed the code but the output is not displaying what changes i want to do......
|
|
|
|
|
hi,
try adding this before your methods: [System.Web.Script.Services.ScriptMethod]Sara, CAPM
|
|
|
|
|
When posting code here you need to format it using pre tags I know the language. I've read a book. - _Madmatt
|
|
|
|
|
iam using asp.net with c#. i want to get alphanumeric no which should be auto generated from database
example (nt234,st675) can any body help ...
|
|
|
|
|
|
you can take help from following link,
http://blog.sqlauthority.com/2007/04/29/sql-server-random-number-generator-script-sql-query/
Hope it will help,Bajrang Singh
Using .net 2.0 (VS2005)
|
|
|
|
|
I create a Datalist and add photos to it in Asp.net.
I need to enlarge the photo when it click.
Selected picture only enlarge when it press and press on other enlarge that picture
Thanks
vipin o.s
|
|
|
|
|
You can use AJAX Model Popup Extender
Or can do using Javascript by show/hide div
onmouseover="showLarge('images\largeImage.jpg');"Best Regards,
Chetan Patel
|
|
|
|
|
As Chetan suggested you can AJAX Modal Popup or you can use JQuery
|
|
|
|
|
|
Problem loading stylesheet - not loaded because its MIME type, "text/html", is not "text/css".
|
|
|
|
|
The reference required should look like:
<link href="CSS/Screen.css" rel="stylesheet" type="text/css" media="screen" /> Tychotics: take us back to the moon
"Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars."
H. G. Wells
|
|
|
|
|
Thanks for your reply! I found the solution. In my case,
the particular part is mentioned under 'deny user'(while not logged on) category in web.config.That's y the style sheet was not loaded. I resolved this by mentioned the 'allow user' property.
|
|
|
|