Technical support This forum is closed.
Version 1.x > Technical support > selectbypath and DataSet View modes: 
User avatar
Member
Member
Chameane - 11/23/2005 9:42:21 AM
   
selectbypath and DataSet
Hi,

How can I get a dataset from a query?
I've tested:

myDataSet = TreeProvider.GeneralConnection.ExecuteQuery("cms.doc_template.selectbypath", nothing, "path = '/docs/%'", "docID")

like in your example but I don't know where can I find "nothing object"...

Thanks

User avatar
Guest
admin - 11/24/2005 7:55:36 AM
   
Re: selectbypath and DataSet
Hello,

does it work for you? If not could you please send me the error message you get?

"nothing" parameter is the same as null in C#. It means that you do not provide any SQL query parameters.

Thank you.

Best Regards,

User avatar
Member
Member
Chameane - 11/25/2005 9:35:36 AM
   
Re: selectbypath and DataSet
Hi,

The error said that 'nothing' wasn't an object in the current namespace...
In fact what I tried to do was to display a list of items, each one with a checkbox and made some calcul depending on what the user have checked.
I could display the list without problems but no question about making calculs.
I finally was able to retrieve the dataset but I couldn't manage the transformation sheets of the kentico document objects to make the calcul (I cannot use "FindControl"), so I've decided to use a normal Datalist and use code behind like this:

<asp:DataList id="dl" runat="server" RepeatColumns="2" RepeatDirection="Horizontal" CellPadding="10">
<ItemTemplate>
<%# DataBinder.Eval(Container, "DataItem.ItemName") %><asp:CheckBox id="CheckBox1" runat="server">
</ItemTemplate>
</asp:Datalist>

..
Boolean isChecked1 = ((CheckBox) dl.Items.FindControl("CheckBox1")).Checked;
...


If it's possible to write a code like this with the kentico CMSDatalist I'd love to know how:

Thanks

User avatar
Guest
admin - 11/29/2005 12:58:53 PM
   
Re: selectbypath and DataSet
Hello,

yes, it should generally work in the same way as with standard DataList. You only need to use your code:

<%# DataBinder.Eval(Container, "DataItem.ItemName") %><asp:CheckBox id="CheckBox1" runat="server">

in the appropriate ASCX transformation.

Regarding the problem with nothing - if you're using C#, you need to write null instead of nothing.

Best Regards,


User avatar
Member
Member
Chameane - 12/2/2005 10:07:25 AM
   
Re: selectbypath and DataSet
Hi, I've found this...

http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx?FeedbackId=d9c93c38-71c7-4fbd-9667-264a1456ba8f

I'm afraid it's a msdn problem... so, as CMSDatalist uses loadtemplate, I can only use an asp:Datalist with the itemtemplate definition on the same page.

User avatar
Guest
gib - 8/3/2006 3:52:42 AM
   
Re: selectbypath and DataSet
I've created a TreeProvider instant using;

Kentico.CMS.TreeEngine.TreeProvider treeProvider = Functions.GetTreeProvider();

the object, "treeProvider" can not find ".GeneralConnection"? What is likely to be the problem?

----------------------------------------------------------------------------------------
Compiler Error Message: CS0117: 'Kentico.CMS.TreeEngine.TreeProvider' does not contain a definition for 'GeneralConnection'
----------------------------------------------------------------------------------------

Thanks

User avatar
Guest
admin - 8/3/2006 8:48:55 AM
   
Re: selectbypath and DataSet
Hello,

the name of the property is TreeProvider.Connection. The type of the property is GeneralConnection.

Best Regards,