Cannot get some field when set Client template with SQLDataSource

5 posts, 2 answers
  1. Do Xuan
    Do Xuan avatar
    16 posts
    Member since:
    Aug 2011

    Posted 16 Nov 2014 Link to this post

    Hi all,
    I try to set Client template for Search Box using SqlDataSource with this code
     
    <telerik:RadSearchBox runat="server" ID="RadSearchBox1" Width="350"
                    DataTextField="LocName" OnClientSearch="OnClientSearch"
                    DataSourceID="SqlDataSource1" DataKeyNames="LocID" DataValueField="LocID">
                    <DropDownSettings Height="400px">
                        <ClientTemplate>
                        <h3>#= Text #</h3>
                        <div class="details">                     
                            <span class="info">
                                <p>
                                    <b> #= DataItem.Descr# </b>                               
                                     <b> #= DataItem.Lang# </b>
                                     <b> #= DataItem.Long# </b>
                                </p>
                            </span>
                        </div>
                        </ClientTemplate>
                    </DropDownSettings>
                </telerik:RadSearchBox>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TDMTConnectionString %>" SelectCommand="SELECT * FROM [tdmt_Location]"></asp:SqlDataSource>

    But it's just get LocName.
    Please, how can i get the others field (Descr, Lang, Long).
    P/S: I custom this code from Client site Searchobox demo
  2. Answer
    Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 19 Nov 2014 Link to this post

    Hi Do Xuan,

    Client Templates are used when control is bound on the client. This includes:
    • WebService
    • WebMethod
    • RadClientDataSource
    • RadODataDataSource
    • Even the manually added items via the Client API of the control.

    For SqlDataSource and all other types of server binding you will have to user Server Templates.


    Regards,
    Hristo Valyavicharski
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Do Xuan
    Do Xuan avatar
    16 posts
    Member since:
    Aug 2011

    Posted 20 Nov 2014 in reply to Hristo Valyavicharski Link to this post

    Thanks Hristo Valyavicharski,
    So, if i want to submit on client (with google map api), what can I do???
    Can i convert SQLDataSource to ODataDataSource or ClientDataSource?
  5. Answer
    Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 25 Nov 2014 Link to this post

    SqlDataSource cannot be converted. You just have replace it with ODataDataSource or ClientDataSource.

    Regards,
    Hristo Valyavicharski
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Do Xuan
    Do Xuan avatar
    16 posts
    Member since:
    Aug 2011

    Posted 25 Nov 2014 Link to this post

    Thanks Hristo Valyavicharski!
    I've been using SqlDataSource combined with AJAXPANEL. However, I will try your way to see its effectiveness.
    Thanks so much!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017