April 2009 Entries

Disable Special Keys in Win App C#

Today, when I was planning to write an article on Grid View. I got a message from a very good friend of mine who is asking to disable the special keys(Windows Keys) in his application. When I start researching on it, I was thinking that it can be done using e.KeyChar but unfortunately, it is not showing any information about windows keys. So in this post I will explain you, how can we disable the special keys (in our case windows keys) in C# Application. 1. Crete a c# windows application project...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

How to pass parameters to the dynamically added user control

In this post, I will explain how you can pass parameter to the dynamically added (from code behind) User Control. Most of you might aware of how we can achieve this in web application project. Following is the code for that 1: Dim objCon As Control = Page.LoadControl("~/Control... 2: Ctype(objCon,MyControl).Pro... = "Test" 3: Ctype(objCon,MyControl).Pro... = "USAM" 4: MyPanel.Controls.add(objCon) Now what if you have a web site project which does not have the pre-compiled...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Get Repeater Control Output in String

In this post I will share with you a small code snippet which will help you to get the repeater control output in string variable. 1: Dim sb As New StringBuilder() 2: Dim objHtml As New HtmlTextWriter(New System.IO.StringWriter(sb)) 3: 4: If dt.Rows.Count > 0 Then 5: Repeater1.DataSource = dt 6: Repeater1.DataBind() 7: End If 8: 9: Repeater1.RenderControl(obj... 10: Return sb.ToString() Well, I have used a little trick here. The RenderControl method of repeater control can put all the HTML in...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati