Archive

Archive for the ‘Development’ Category

New Telerik Q1 2010 (part 3)

March 26th, 2010 gerbrand No comments

I forgot to add a post about the webinar about the Telerik winform controls, presented by Robert Shoemate (twitter: @shoerob).

In this release the added a new layout for the visual style builder, a list of visual states and repository items. Now a nice feature that I like the most is that you can edit all controls at once. In the previous releases this wasn’t possible. You needed to edit your controls one by one. But now this isn’t the case any more and you can easily edit all controls.

So whats new in the controls, well they changed the radschedular. A new timeline view : horizontal display.
Other key features are:

  • Duration
  • timescale
  • user interaction
  • resource grouping

Further on he talked about the visual studio extensions and about Telerik Reporting.

I’m not going to write everything he said in the whole webinar. The best way is to go and listen for your self :-) .

Greetzz and until next post…

Categories: Development, Telerik Tags:

Code Bubbles

March 11th, 2010 gerbrand No comments

Code bubbles an amazing new way of how developers can work (only Java support for the moment). I saw the video and I was amazed and curious how this development will go further.
I signed myself up for the beta and waiting until it’s released.

The essential goal of this project is to make it easier for developers to see many fragments of code (or other information) at once without having to navigate back and forth. Each of these fragments is shown in a bubble.

Check it out!

Greetzz and until next post …

Categories: Development, Java Tags:

New Telerik Q1 2010 (part 2)

March 11th, 2010 gerbrand No comments

Yesterday the first release of Telerik controls 2010 was a fact. Today I’m going to download the release and have a look at the new controls and performances, …

Evan Hutnick presented yesterdays webinar about the RadControls for Silverlight and WPF. (He can be followed at Twitter: @evanhutnick) In this release for they have some cool new RadControls like the RadMap, RadTransition CTP and RadBook. They also improved the themes and animations in the RadChart (more professional looks).

If you want to view this webinar, go to the following link: tv.telerik.com -> “What’s new in RadControls for Silverlight and WPF in Q1 2010″.

Today the webinar is going about “What’s new in RadControls for Winforms and reporting in Q1 2010″ -> can’t wait that the webinar starts :-) .

Greetzz and until next post…

Categories: C#, Development, Telerik Tags:

New Telerik Q1 2010

March 9th, 2010 gerbrand No comments

Tomorrow the first release of Telerik controls 2010 will be a fact. Today I allready had a glimps of the new asp.net ajax & mvc at the webinar.

Todd Anglin presented this webinar. (He can be followed at Twitter: @toddanglin) In this release they focussed on performance an productivity features.

If you want to view this webinar, go to the following link: tv.telerik.com/home -> “What’s new in RadControls for ASP.NET AJAX & Telerik Extensions for MVC in Q1 2010″.

When you are really interested in predefined controls you need to check it out!!

Greetzz and until next post…

Categories: C#, Development, Telerik Tags:

RadGrid Drag and Drop

May 27th, 2009 gerbrand No comments

Hello,

For the people that are looking for a drag and drop example with the Telerik controls. You can find it here in my example program I used in a previous post. I updated it so the drag and drop can be shown.

radgriddragdrop.rar

You can also download the code at Telerik.

Have fun

Categories: C#, Development, Telerik Tags:

RadGridRow color

May 6th, 2009 gerbrand No comments

On the Telerik Forum there was a question regarding changing the row color when the checkbox in that row is selected.

I made a small example project for that guy (Jerry) I hope that this is the thing you needed or that it helps you to the right solution.

screenshot radgrid row color

The code:

(update 6/5/09:  code with a better selection and also a radmenu is generated like you wanted Jerry)
(update 7/5/09: code with an event handler on the lowest menu items)
(update 14/05/09: added some small lines of code that changes the forecolor of a gridcellelement.)

radgridviewsamples.rar

Greetz and until next post

Categories: C#, Development, Telerik Tags:

Transfer data from MySql To MsSql

May 5th, 2009 gerbrand No comments

Okay, yesterday I had the problem of a slow data transfer between MySql and MsSql express edition 2005. Around 120000 records in one table I took almost 30 minutes.

Since I’m inserting it row by row I thought -> that should go faster. So After some googling I found that with the new sql express edition 2008 (MSSQL) that you can do a sql syntax that is the same like MySql.

Something like: insert into table (column1, column2) values (‘aae’, ‘ert’), (‘dsf’, ‘erg’), (‘rer’, ‘tea’);

So I updated my visual studio 2008 and the sql express edition.

After that I wrote something like this to achieve what I needed. Keeping in mind that maximum of (…),(…)(…) is a 1000 records. Because I’m having around 120000 records I loop and keep the records around 1000.

Here is my code:

var count = “SELECT COUNT(*) as rowcount FROM mysqlTable GROUP BY id”; //query to fetch data from the MySql Database
var countReader = Retrieve(count); //goes to a function that gets an IDataReader back for the MySql database
var countRows = 0;
try
{
while(countReader.Read()) {
countRows += int.Parse( countReader.GetValue(0).ToString() );
}
} catch(Exception ex) {
Console.WriteLine(ex.StackTrace + ” /n” + ex.Message);
} finally {
if (countReader != null) { countReader.Close(); _crud.close_conn(); }
}

for(var a = 0; a < countRows;)
{
var sql = “SELECT id, column1, column2 FROM mysqlTable LIMIT ” + a + “, ” + (999) + “”;

var reader = Retrieve(sql); // retrieves the IDataReader for MySql
try
{
var builder = new StringBuilder();
builder.Append(“INSERT INTO mssqlTable(id, column1, column2) VALUES “);

while (reader.Read()) {
try
{
builder.Append(“(” + reader.GetValue(0) + “, ” + reader.GetValue(1) + “, ” +
reader.GetValue(2) + “), “);
} catch (Exception ex) {
Log.LogMessageToFile(“Import.cs -> InsertTrafficHod: ” + ex.StackTrace + ” /n” + ex.Message);
}
}
var sqlDB = builder.ToString(0, builder.Length – 2);

if (!InsertDB(sqlDB)) //insert into the MSSQL 2008 express edition and return a boolean
{
Console.WriteLine(“No insert happend!”);
}
} catch (Exception ex) {
Console.WriteLine(ex.StackTrace + ” /n” + ex.Message);
} finally {
if (reader != null) { reader.Close(); _crud.close_conn(); } //close all connections
}
a = a + 999; //set counter to retrieve next block of values
}

Maybe this isn’t the right solution. So if somebody has another better, faster solution to copy data from MySql To MsSql, just let me know. But for now this is good enough.

Greetzz and until next post.

Categories: C#, Development Tags:

Binding data to the telerik RadGridView

April 16th, 2009 gerbrand No comments

Something I’m doing very often in my winforms is binding a list of objects (with hierarchy) in my radgridview.
because our hierarchy structure is based on left and right (more information about this here).

Okay lets start at the beginning. for this example I’m keeping it simple actually, it’s just that you get the idea.
First thing you have to do is creating your list of objects with all the data you need (the hierachical structure also).
In this example I’m creating a simple object for the moment.


//load your List
var myListMaster = new List();
var child1 = new List();
child1.Add(new Child{ Id = 2, Name = "ChildTest2" });
child1.Add(new Child{ Id = 3, Name = "ChildTest3" });
var child2 = new List();
child1.Add(new Child{ Id = 5, Name = "ChildTest5" });
child1.Add(new Child{ Id = 6, Name = "ChildTest6" });
child1.Add(new Child{ Id = 7, Name = "ChildTest7" });
myListMaster.Add(new Master { Id = 1, Name = "Test", Childs = child1 });
myListMaster.Add(new Master { Id = 4, Name = "Test2", Childs = child2 });

Once you have your data into your objects you start to create your columns and add your data.

1 //clear the gridview of everything
2 radGridView.MasterGridViewTemplate.Columns.Clear();
3 radGridView.MasterGridViewTemplate.Rows.Clear();
4 radGridView.MasterGridViewTemplate.ChildGridViewTemplates.Clear();
5
6
7 //add the columns for the master
8 radGridView.MasterGridViewTemplate.Columns.Add(new GridViewDataColumn { FieldName = "Id", HeaderText = "Name", HeaderTextAlignment = ContentAlignment.MiddleCenter });
9 radGridView.MasterGridViewTemplate.Columns.Add(new GridViewDataColumn { FieldName = "Name", HeaderText = "Adserver Id", HeaderTextAlignment = ContentAlignment.MiddleCenter });
10 radGridView.MasterGridViewTemplate.Columns.Add(new GridViewDataColumn { FieldName = "Active", HeaderText = "Active", HeaderTextAlignment = ContentAlignment.MiddleCenter });
11
12 //add the columns for the childs
13 var template = new GridViewTemplate { AllowAddNewRow = false, AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill };
14 template.Columns.Add(new GridViewTextBoxColumn { FieldName = "Id", IsVisible = false });
15 template.Columns.Add(new GridViewTextBoxColumn { FieldName = "IdChild", HeaderText = "Zone Name", HeaderTextAlignment = ContentAlignment.MiddleCenter});
16 template.Columns.Add(new GridViewTextBoxColumn { FieldName = "NameChild", HeaderText = "Zone Id", HeaderTextAlignment = ContentAlignment.MiddleCenter});
17
18 //add the childtemplate to the master
19 radGridView.MasterGridViewTemplate.ChildGridViewTemplates.Add(template);
20
21 //make the relationship between master and child
22 var relation = new GridViewRelation(radGridView.MasterGridViewTemplate)
23 {
24 ChildTemplate = template,
25 RelationName = "SiteZonesNetwork"
26 };
27
28 relation.ParentColumnNames.Add("Id"); //equals the fieldname
29 relation.ChildColumnNames.Add("Id"); //equals the fieldname
30
31 //add the relation
32 radGridView.Relations.Add(relation);
33
34
35 //load your List
36 var myListMaster = new List();
37
38 var child1 = new List();
39 child1.Add(new Child{ Id = 2, Name = "ChildTest2" });
40 child1.Add(new Child{ Id = 3, Name = "ChildTest3" });
41
42 var child2 = new List();
43 child1.Add(new Child{ Id = 5, Name = "ChildTest5" });
44 child1.Add(new Child{ Id = 6, Name = "ChildTest6" });
45 child1.Add(new Child{ Id = 7, Name = "ChildTest7" });
46
47 myListMaster.Add(new Master { Id = 1, Name = "Test", Childs = child1 });
48 myListMaster.Add(new Master { Id = 4, Name = "Test2", Childs = child2 });
49
50
51 //fill the radgridview
52 foreach(var myMaster in myListMaster){
53
54 radGridView.MasterGridViewTemplate.Rows.Add(new object[] { myMaster.Id, myMaster.Name, myMaster.Active });
55 template = radGridView.MasterGridViewTemplate.ChildGridViewTemplates[0];
56
57 foreach(var child in myMaster.childs){
58
59 template.Rows.Add(new object[] { myMaster.Id, child.Id, child.Name });
60 }
61
62 }

Where my 2 objects are written like this:

1 public class Master{
2 public int Id {get;set;}
3 public string Name {get;set;}
4 public List Childs{get;set;}
5 }
6
7 public class Child{
8 public int Id{get;set;}
9 public string Name {get;set;}
10 }

okay but what if your hierarchy is in one list of objects? So you have this structure:


class myObject{
public int Id {get;set;}
public string Name {get;set;}
public int ParentId {get;set;}
}

the thing is that you have a list of myObject with both parent and child.

now the only part of the above code you have to change is the reading of the object


1 foreach (var item in myObjectList )
2 {
3 if (item.ParentId == 0) //we've got a parent
4 {
5 gridview.MasterGridViewTemplate.Rows.Add(new object[] { item.Id, item.Name });
6 template = gridview.MasterGridViewTemplate.ChildGridViewTemplates[0];
7 }
8 else // we've got or child
9 {
10 if (template == null) continue;
11 template.Rows.Add(new object[] { item.ParentId, item.Id, item.Name});
12 }
13 }

This is only an example of a 2 level hierarchy. You can easily add more levels to your hierarchy.

I hope this helps for some people

Greetzz and until next post

Categories: C#, Telerik Tags:

About Telerik Controls

April 13th, 2009 gerbrand No comments

So my second post is going about Telerik in general. If you are an asp.net or winforms developer and you don’t know Telerik. Shame on you :-) .

So Telerik is a set of controls (asp.net, wpf, winforms, silverlight …) that you can use in your projects(C# or VB.net). Currently I’m programming a tool that’s written in winforms (c#) and I’m using the RadGridView of Telerik to show large sets of data to the user.

Honestly I have to say that this was very easy to implement in my application. Okay I had some questions from time to time, but with the very good customer care program, those questions where quickly solved.

I never had this kind of support. You will always have an answer to your questions and every problem (question) I had during programming, is solved. Most general things on the radGridView, you can find it in the help files which are very complete.

Okay besides the nice support they have, they have nice looking controls and if you don’t like the styling, you can easily change them with the theme manager. The controls aren’t just very handy in use, they have a nice wow effect on you application.

The performance of the controls is also very exciting. I don’t have the right timing on my data load, but they are fast, I must say. I will add a log about this profiling another time.

Well if you need more information about Telerik, just go to their website: http://www.telerik.com or download the trail.

Greetzz and until the next post.

Categories: Development, Telerik Tags: