API Questions on Kentico API.
Version 5.x > API > How to customize the query for the User Viewer webpart using the UsersFilter control View modes: 
User avatar
Member
Member
Lunga.Ramollo-bcx.co - 10/29/2012 4:10:29 AM
   
How to customize the query for the User Viewer webpart using the UsersFilter control
Hi Guys

I am trying to get my user viewer webpart to read users details from the whole table CMS_Users but it always retreives data from the current site i am working on. I modified this code in my the SetupControl method of userviewer web part

string strConnString2 = "Persist Security Info=False;database=NMMUWeb-S;server=blaze;user id=kentico-admin;password=ka2010;Current Language=English;Connection Timeout=240;";
SqlConnection conn = new SqlConnection(strConnString2);
SqlCommand sqlCom = new SqlCommand("select * from CMS_User ", conn);
SqlDataAdapter da = new SqlDataAdapter(sqlCom);
DataSet ds = new DataSet();

da.Fill(ds);

conn.Open();

SqlDataReader reader = sqlCom.ExecuteReader();


repUsers.DataSource = ds;
repUsers.DataBind();

With this it fixed the issue and read all the users in the database when i initially load the page, now when i try to use the filter control (filterUsers.FilterName) it doesn't work.

Please help

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 11/8/2012 8:21:14 PM
   
RE:How to customize the query for the User Viewer webpart using the UsersFilter control
Hello,

Regrettably I wasn't able to get your setup running. I've noticed, you are using two controls. Is that necessary? This control is already for a specific task and I don't think it can be re-used for a different purpose. Anyway, could you please send me the files instead and instructions how to set it up? Additionally, have you been following our tutorial on filter web parts?

creating filters

Best regards,
Boris Pocatko