combo box items retrieve from database getting error

  1. #1

    combo box items retrieve from database getting error

    I am a new user of ext dot net.
    I am trying an ext dot net combo box in my web application form. But it is not working. I am getting error No overload for 'TempGetAddress' matches delegate 'SyncStoreBase.AjaxReadDataEventHandler'. I can not understand what this error indicates and how to solve this error. Please can anyone help me.

    My code ::
    <%@ Page Language="C#" MasterPageFile="Global.master" AutoEventWireup="true" CodeBehind="OPDRegister.aspx.cs" Inherits="Medical_Intelligence_System.content.OPDRegister" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
    <asp:Content ID="AdminContent" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
        
        <ext:ResourceManager runat="server" />
        <asp:Panel ID="register_OPD_registration" runat="server">
            <asp:ScriptManager ID="adminScriptManager" runat="server" EnablePageMethods="true"></asp:ScriptManager>
            <table class="nostyle" style="height: 350px">  
                <%--ext testing --%>
                <tr>
                    <td class="va-top" style="width: 70px;">Ext Address:</td>
                    <td>
                        <ext:ComboBox runat="server" EmptyText="--- SELECT ---" DisplayField="name">
                            <Store>
                                <ext:Store ID="store1" runat="server" OnReadData="TempGetAddress">
                                    <Model>
                                        <ext:Model runat="server" IDProperty="value">
                                            <Fields>
                                                <ext:ModelField Name="ADDRESS" />
                                                <ext:ModelField Name="ID" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <DirectEvents>
                                <Change OnEvent="valueType_SelectedIndexChanged" />
                            </DirectEvents>
                        </ext:ComboBox>
                    </td>
                </tr>
    			
                <asp:UpdatePanel ID="updatePanel10" runat="server">
                    <ContentTemplate>
                        <tr>
                            <td class="va-top">Address:</td>
                            <td>
                                <asp:ListBox ID="listBoxAddress" runat="server" Rows="1" Width="300px">
                                    <%--<asp:ListItem Value="">--- SELECT ADDRESS ---</asp:ListItem>--%>
                                </asp:ListBox>
                                <ajaxToolkit:ListSearchExtender ID="toolkit_srch_address" runat="server" 
                                    TargetControlID="listBoxAddress"
                                    PromptText="SEARCH ADDRESS" 
                                    PromptPosition="Top" QueryPattern="Contains"
                                    IsSorted="true">
                                </ajaxToolkit:ListSearchExtender>
                            </td>
                            <td>
                                <asp:Button ID="btn_address" runat="server" Text="Set Address" OnClick="btn_address_Click1" />
                                <asp:RequiredFieldValidator runat="server" ID="rfv4"
                                    ControlToValidate="listBoxAddress"
                                    Display="Dynamic"
                                    ValidationGroup="btnSubmitClick"
                                    ErrorMessage="*"> </asp:RequiredFieldValidator>
                            </td>
                        </tr>
    
                        <%--rest of code blocks--%>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <tr>
                    <td style="width: 200px;" class="va-top">Previous Visit Date:</td>
                    <td>
                        <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                            <ContentTemplate>
                                <asp:TextBox ID="txtPreVisitDt" runat="server" SkinID="txtuppercase" class="input-text" Width="300px"></asp:TextBox>
                                <asp:Image ID="Image1" runat="server" ImageUrl="~/content/design/calendar_month.gif" Style="cursor: pointer" />
                                <ajaxToolkit:CalendarExtender ID="CalendarExtender1"
                                    runat="server"
                                    Format="yyyy-MM-dd"
                                    PopupButtonID="calendarImg1"
                                    TargetControlID="txtPreVisitDt" />
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
               
                <tr>
                    <td colspan="2" class="t-right">
                        <asp:Button ID="submit" class="input-submit" runat="server" Text="Submit" OnClick="submit_Click"
                            CausesValidation="true"
                            ValidationGroup="btnSubmitClick" />
                    </td>
                </tr>
            </table>
        </asp:Panel>   
    </asp:Content>
    code behind logic ::

    public void TempGetAddress()
            {
                try
                {
                    DataTable dt = new DataTable();
                    DAL_Patient_Registration objDAL = new DAL_Patient_Registration();
                    dt = objDAL.Get_Address();
                    foreach (DataRow row in dt.Rows)
                    {
                        listBoxAddress.Items.Add(new ListItem(row["ADDRESS"].ToString(), row["ID"].ToString()));
                    }
    
                }
                catch (Exception) { }
            }
  2. #2
    Hello @hadoop!

    Yes, this is not going to work as you provided. Your sample code is far from simple so I'm afraid we can't run it in our side to be able to reproduce the issue.

    But reading it, I can see that you are not using the right and expected syntax for the code behind method. Besides, I'm not sure it is what you really want, to instead of filling the combobox with data, be filling another ASP.NET component with...

    Well, take a look on this example, it shows a proper usage of the OnReadData setting and how to define it: Forms - ComboBox - Ajax linked combos. I am sure this will help you fix your example.

    As a new Ext.NET user I'd suggest you to take some time to browse the examples and see what you can get out of Ext.NET. Remembering one or another could bring you good insight when you are trying to solve a problem or draw a new page.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Combo box unable load data from database
    By indrabayu in forum 4.x Help
    Replies: 4
    Last Post: Apr 19, 2016, 6:47 AM
  2. image store in database and retrieve
    By Vaishali in forum 2.x Help
    Replies: 2
    Last Post: Jan 02, 2013, 3:35 PM
  3. retrieve data from database using jsf
    By Rukia in forum 1.x Help
    Replies: 0
    Last Post: Jun 02, 2011, 11:38 PM
  4. Replies: 0
    Last Post: Sep 18, 2009, 9:56 AM
  5. Replies: 0
    Last Post: May 08, 2009, 5:39 AM

Tags for this Thread

Posting Permissions