Solved

jquery autocomplete in gridview , Asp.Net

Posted on 2010-11-19
4
2,302 Views
Last Modified: 2012-05-10
I want to populate autocomplete in gridview with jquery.

Please help me?
My Code:-
<link href="../Css/jquery.autocomplete.css" rel="stylesheet" type="text/css" />

    <script src="../js/jquery-1.4.1.min.js" type="text/javascript"></script>

    <script src="../js/jquery.autocomplete.js" type="text/javascript"></script>

    <asp:MultiView ID="MultiView1" runat="server">
        <asp:View ID="View1" runat="server">
            <asp:TextBox ID="txtcertid123" runat="server" Text='<%# Eval("Cert_Id") %>'></asp:TextBox>
            <br />
            <asp:Label ID="Label1" runat="server" Text="Login Id :"></asp:Label>
            <asp:TextBox ID="txtloginid" runat="server"></asp:TextBox>
            &nbsp;<asp:Label ID="Label2" runat="server" Text="Branch :"></asp:Label>
            <asp:TextBox ID="txtbranch" runat="server"></asp:TextBox>
            &nbsp;<asp:Label ID="Label18" runat="server" Text="Username :"></asp:Label>
            <asp:TextBox ID="txtusername0" runat="server"></asp:TextBox>
            &nbsp;<asp:Label ID="Label17" runat="server" Text="Pincode :"></asp:Label>
            <asp:TextBox ID="txtpincode" runat="server"></asp:TextBox>
            &nbsp;<br />
            <asp:Label ID="Label11" runat="server" Text="Status :"></asp:Label>
            <asp:CheckBox ID="chkstatus" runat="server" />
            <br />
            <br />
            <asp:GridView ID="gvodinuserdtl" runat="server" AutoGenerateColumns="False" Width="95%"
                OnDataBound="gvodinuserdtl_DataBound" OnRowDataBound="gvodinuserdtl_RowDataBound">
                <Columns>
                    <asp:TemplateField Visible="false">
                        <ItemTemplate>
                            <asp:Label ID="lblid" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Segment">
                        <ItemTemplate>
                            <asp:DropDownList ID="ddlsegment" runat="server">
                            </asp:DropDownList>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Neat Id">
                        <ItemTemplate>
                            <asp:TextBox ID="txtneatid" runat="server" Text='<%# Eval("Neat_id") %>'></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Branch Id">
                        <ItemTemplate>
                            <asp:TextBox ID="txtbranchid" runat="server" Text='<%# Eval("Branch_Id") %>'></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Ctcl Id">
                        <ItemTemplate>
                            <asp:TextBox ID="txtctcl_Id" runat="server" Text='<%# Eval("Ctcl_Id") %>'></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <br />
            <asp:GridView ID="gvodinusercertdtl" runat="server" AutoGenerateColumns="False" Width="45%"
                OnRowDataBound="gvodinusercertdtl_RowDataBound">
                <Columns>
                    <asp:TemplateField Visible="false">
                        <ItemTemplate>
                            <asp:Label ID="lblid" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Certificate">
                        <ItemTemplate>
                            <input id="txtcertid" type="text" name="txtcertid" runat="server" value='<%# Eval("Cert_Id") %>' />
                            <script type="text/javascript">
                                $(document).ready(function() {
                                    $("#<%=txtcertid.ClientID%>").autocomplete('../Autocomplete.ashx');
                                });      
    </script>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <br />
            <asp:Button ID="btnsave" runat="server" Text="Save" Width="65px" OnClick="btnsave_Click" />
            &nbsp;<asp:Button ID="btnupdate" runat="server" Text="Update" Visible="False" Width="65px"
                OnClick="btnupdate_Click" />
            <asp:LinkButton ID="lnkbtnlisting" runat="server" OnClick="lnkbtnlisting_Click">Listing</asp:LinkButton>
        </asp:View>
        <asp:View ID="View2" runat="server">
            <asp:Label ID="Label16" runat="server" Text="Login Id :"></asp:Label>
            <asp:TextBox ID="txtloginidsearch" runat="server"></asp:TextBox>
            &nbsp;&nbsp;<asp:Label ID="Label13" runat="server" Text="Branch :"></asp:Label>
            &nbsp;<asp:TextBox ID="txtbranchsearch" runat="server"></asp:TextBox>
            <asp:Label ID="Label14" runat="server" Text="Username :"></asp:Label>
            <asp:TextBox ID="txtusernamesearch" runat="server"></asp:TextBox>
            &nbsp;<asp:Button ID="btnsearch" runat="server" Text="Search" OnClick="btnsearch_Click" />
            <asp:LinkButton ID="lnkbtnaddnew" runat="server" OnClick="lnkbtnaddnew_Click">Add New</asp:LinkButton>
            <br />
            <asp:GridView ID="gvcontactlist" runat="server" AutoGenerateColumns="False" Width="95%"
                OnRowCommand="gvcontactlist_RowCommand" OnRowEditing="gvcontactlist_RowEditing">
                <Columns>
                    <asp:TemplateField Visible="false">
                        <ItemTemplate>
                            <asp:Label ID="lblid" runat="server" Text='<%# Eval("Odin_User_id") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="LoginId">
                        <ItemTemplate>
                            <asp:Label ID="lblloginid" runat="server" Text='<%# Eval("Login_id") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Branch">
                        <ItemTemplate>
                            <asp:Label ID="lblbranch" runat="server" Text='<%# Eval("branchcode") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="User Name">
                        <ItemTemplate>
                            <asp:Label ID="lblusername" runat="server" Text='<%# Eval("user_name") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Pincode">
                        <ItemTemplate>
                            <asp:Label ID="lblpincode" runat="server" Text='<%# Eval("pincode") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkedit" runat="server" Text="edit" CommandName="edit" CommandArgument='<%# Eval("Odin_User_id") %>'></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <br />
        </asp:View>
    </asp:MultiView>

I am getting  this error:-

Compiler Error Message: CS0103: The name 'txtcertid' does not exist in the current context

Source Error:

 

Line 73:                             <script type="text/javascript">
Line 74:                                 $(document).ready(function() {
Line 75:                                     $("#<%=txtcertid.ClientID%>").autocomplete('../Autocomplete.ashx');
Line 76:                                 });      
Line 77:     </script>
 

Source File: d:\UITS\UITS.UI\Pages\Odin_UserId_Master.aspx    Line: 75



0
Comment
Question by:dynamicweb09
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 7

Accepted Solution

by:
dxdinh earned 250 total points
ID: 34177842
Can you textbox server control instead of input control runat server

Change this

<input id="txtcertid" type="text" name="txtcertid" runat="server" value='<%# Eval("Cert_Id") %>' />

to
<asp:TextBox ID="txtcertid" runat="server" Text='<%# Eval("Cert_Id") %>'></asp:TextBox>
0
 
LVL 14

Assisted Solution

by:CtrlAltDl
CtrlAltDl earned 250 total points
ID: 34189784
Try this out:

$(document).ready(function() {
    $('[id$=txtcertid]').autocomplete('../Autocomplete.ashx');
});  
0
 
LVL 29

Expert Comment

by:Kumaraswamy R
ID: 34387742
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question