Portal Engine
Version 3.x > Portal Engine > User-Input Datalist "WHERE" condition... View modes: 
User avatar
Member
Member
SocuteRaptor-gmail - 11/18/2008 2:29:10 AM
   
User-Input Datalist "WHERE" condition...
Can someone show me how to create a text box, that user will input some values, and then a datalist will get that value into it's WHERE condition...?
Thanks...

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/19/2008 6:00:52 AM
   
RE:User-Input Datalist "WHERE" condition...
Hi,

You need to modify the layout of the datalist - http://www.kentico.com/docs/devguide/customizing_web_part_layout.htm.

It is recommended to create a custom clone of the web parts - http://www.kentico.com/docs/devguide/modifying_the_design_of_standa.htm.

Then, you will add the text box to the datalist and its value you will pass to the wherecondition. For example:

this.lstElem.WhereCondition = TextBox1.Text;

The second option is, if you are using ASPX templates, to add the text box to the aspx page and then pass the value in Page_Load() method. Please do not forget to force the ReloadData method method to apply the change.

Best Regards,
Juraj Ondrus


User avatar
Member
Member
SocuteRaptor-gmail - 11/21/2008 1:30:58 AM
   
RE:User-Input Datalist "WHERE" condition...
I don't know about it's core... But I cloned a datalist, and didn't modify anything in it's code... And when I add it to my site, it didn't work... The cloning process has some error?

When I view it's code, it's totaly different than the original one... So it's how the cloning've done? So a cloned datalist is not a datalist even when I don't modify anything, and it can't display anything at all...

So what should I do now? Modify the original one? Or using copy + paste manually?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/21/2008 5:05:52 AM
   
RE:User-Input Datalist "WHERE" condition...
Hi,

that is very strange. The cloning of the web part is in general the copy of the original.

I do not know if you are using portal engine templates or ASPX templates. But you can also copy the code files and change the class inheritance and it will be working.

But I have another option for you right now. You can create custom control (or also web part - it depends on the class inheritance) and you will put into this control the default datalist + your field and then pass the values from the field to the datalist. I hope it makes sense.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
SocuteRaptor-gmail - 11/24/2008 12:59:27 AM
   
RE:User-Input Datalist "WHERE" condition...
I've found another way to do this already... Thank you anyway. You're very kind...

User avatar
Member
Member
SocuteRaptor-gmail - 11/25/2008 4:54:03 AM
   
RE:User-Input Datalist "WHERE" condition...
Hi,

You need to modify the layout of the datalist - http://www.kentico.com/docs/devguide/customizing_web_part_layout.htm.

It is recommended to create a custom clone of the web parts - http://www.kentico.com/docs/devguide/modifying_the_design_of_standa.htm.

Then, you will add the text box to the datalist and its value you will pass to the wherecondition. For example:

this.lstElem.WhereCondition = TextBox1.Text;

The second option is, if you are using ASPX templates, to add the text box to the aspx page and then pass the value in Page_Load() method. Please do not forget to force the ReloadData method method to apply the change.

Best Regards,
Juraj Ondrus
---------------------------------------------------------------------------------------------------------------------

I understand this. But... If I want that text box on the Home page, but the datalist is on another page, call Result page... And when the OK button on the home page is clicked... it'll redirect to the Result page and the text on that text box will be put in to the where condition of the datalist on Result page... So how can I do that?

Thank you. :)

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/25/2008 6:30:06 AM
   
RE:User-Input Datalist "WHERE" condition...
Hi,

You can simply place the drop down list into your page as a form control or web part or directly to the ASPX code of your page. Then you will need to handle the button click event. In this event you will get the value from the drop down and redirect to appropriate page where the datalist is. The value from the drop down list can be passed to the second page e.g. using query string parameter.

Best Regards,
Juraj Ondrus