This is a migrated thread and some comments may be shown as answers.

Cannot get some field when set Client template with SQLDataSource

4 Answers 43 Views
SearchBox
This is a migrated thread and some comments may be shown as answers.
Do Xuan
Top achievements
Rank 1
Do Xuan asked on 16 Nov 2014, 01:11 PM
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

4 Answers, 1 is accepted

Sort by
0
Accepted
Hristo Valyavicharski
Telerik team
answered on 19 Nov 2014, 04:03 PM
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.

 
0
Do Xuan
Top achievements
Rank 1
answered on 21 Nov 2014, 12:05 AM
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?
0
Accepted
Hristo Valyavicharski
Telerik team
answered on 25 Nov 2014, 02:27 PM
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.

 
0
Do Xuan
Top achievements
Rank 1
answered on 26 Nov 2014, 01:28 AM
Thanks Hristo Valyavicharski!
I've been using SqlDataSource combined with AJAXPANEL. However, I will try your way to see its effectiveness.
Thanks so much!
Tags
SearchBox
Asked by
Do Xuan
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Do Xuan
Top achievements
Rank 1
Share this question
or