Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > SQLDataSource modification View modes: 
User avatar
Member
Member
Phil. E. - 4/26/2012 7:56:45 AM
   
SQLDataSource modification
I placed my SQLDataSource and Basi Repeater on my page, connected to my database and ran the page. Hey presto, it worked. Now I need to filter it and I've found that, according to this site, I need to clone and modify the webpart. Not a clue !

I've opened it up in VWD and added a label, textbox and button.

Starting simple (I've never used C#.net) I modified the following line:

this.srcSQL.QueryText = this.QueryText

to

this.srcSQL.QueryText = this.QueryText + "WHERE Description LIKE '%" + TextBox1.Text + "%'";

Put some default text into the textbox and saved.

It worked.

My button is set to run that line of code again when I've change the text in the textbox. This works in Edit and Preview but not on the live site. On the live site it always returns the result of the initial default text.

Another side effect is that if I hit enter while in the text box I get thrown back into the login page :0)

Is there a tutorial anywhere dealing with this specific web part and am I even going in the right direction?

User avatar
Member
Member
Phil. E. - 4/26/2012 8:58:23 AM
   
RE:SQLDataSource modification
OK ,got it:
Clear the cashe on button press.
do the same for TextBox content change and enable AutoPostBack and it all works.

Still don't know if this is the correct way of doing this though.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 4/29/2012 4:51:13 AM
   
RE:SQLDataSource modification
Hello,

Kudos for your first .NET code! Yes, this sounds about right, if the page is cached, the cached content is returned until the cache expires. You can disable the cache for the given page (CMSDesk / Properties / General) if that is an option for you. Usually, dynamic pages aren't cached. There are some exceptions (e.g. for small changes, like a salutation substitution macros can be used), but in general you should disable full page caching and enable partial caching on web parts which aren't changed to leverage the caching as much as possible.

Best regards,
Boris Pocatko

User avatar
Member
Member
Phil. E. - 4/30/2012 10:27:56 AM
   
RE:SQLDataSource modification
Thanks Boris, Good to know I'm going in the right direction :0)