Feeds:
Posts
Comments

Archive for the ‘ASP.Net’ Category

I haven’t update my blog for so long.

So now i’m officially announcing that my blog will be stopped for a while until I got some new post or I have the mood to write new posts 🙂

Thanks for visiting.

Advertisements

Read Full Post »

ASP.NET AJAX 1.0 has finally released.

You can check out the the detail info at ScottGu’s blog.

Read Full Post »

I’ve been goolgled for a copuple of weeks ago on how to display multi-column in web treeview. Unforetunately I didn’t find any control that meets my reqirement 

But I found out a simple way to show multi-column in treeview.

Here’s a simple sample on how to show multi-column data in web Treeview (MS IE Web Controls).
But have some limitations. So it’s not very good
It doesn’t support for n-levels tree hierarchy and it depends on the treeNode’s text also.
If the treeNode’s Text is so long, then ur tree’s nest level also decrease.
But anyway, it might useful for people who wanna display data in multi-column format and the tree depth is not high. Hope it might give some help for u guys…Here’s the some sample code:


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack ThenobjTreeView.SystemImagesPath = Server.MapPath(”~/TreeRef/webctrl_client/1_0/treeimages/”)

PopulateTree()

End If

End SubPrivate Sub PopulateTree()Dim objRoot As New Microsoft.Web.UI.WebControls.TreeNode

objRoot.Text = “Root”

objRoot.ImageUrl = Server.MapPath(”../Images/Tree/Glob.gif”)

objTreeView.Nodes.Add(objRoot)

LoadSubChild(objRoot, 10)

objTreeView.DataBind()

End Sub

Private Sub LoadSubChild(ByVal objRoot As Microsoft.Web.UI.WebControls.TreeNode, ByVal childCount As Integer)

‘Add first level 100 childsDim i As Integer

For i = 0 To childCount

Dim objFChild As New Microsoft.Web.UI.WebControls.TreeNode

‘Calculat the treenode level

Dim iLevel As Integer = GetTreeNodeLevel(objRoot)

Dim _MaxWidth As Integer = 1000

Dim iWidth As Integer = iLevel * 19

Dim _tableWidth As String = CType((_MaxWidth – iWidth), String) + “px”

Dim _col1Text As StringIf (_MaxWidth – iWidth) – 600 <= 10 Then

_col1Text = “…”Else

_col1Text = “Child” + i.ToString

End If

Dim _Col1Width As String = CType((_MaxWidth – iWidth) – 600, String) + “px”

Dim _Col2Width As String = “200px”

Dim _Col3Width As String = “200px”Dim _Col4Width As String = “200px”

Dim str As String = “<table cellspacing=’0′ cellpadding=’0′ border=’0′ width=” + _tableWidth.ToString + “height=’100%’><tr><td style=’width:” + _Col1Width.ToString + “‘>” + _col1Text.ToString + “</td><td style=’width:” + _Col2Width.ToString + “‘>Col 2</td><td style=’width:” + _Col3Width.ToString + “‘>Col 3</td><td style=’width:” + _Col4Width.ToString + “‘>Col 4</td></tr></table>”objFChild.Text = str‘Set file and folder alternately.

objFChild.ImageUrl = Server.MapPath(”../Images/Tree/folder.gif”)

objFChild.Expandable = Microsoft.Web.UI.WebControls.ExpandableValue.Always

objRoot.Nodes.Add(objFChild)

Next

End SubPrivate Function GetTreeNodeLevel(ByVal objRoot As Microsoft.Web.UI.WebControls.TreeNode) As Integer

Dim count As Integer

Do While objRoot.Parent.GetType Is GetType(Microsoft.Web.UI.WebControls.TreeNode)

count += 1If Not IsNothing(objRoot.Parent) Then

objRoot = objRoot.Parent

Else

Exit Do

End If

Loop

Return count

End Function

Private Sub objTreeView_Expand(ByVal sender As Object, ByVal e As Microsoft.Web.UI.WebControls.TreeViewClickEventArgs) Handles objTreeView.Expand

If Not e.Node = “0″ Then

‘Load the subchild nodes

Dim str As System.Text.StringBuilder

LoadSubChild(objTreeView.GetNodeFromIndex(e.Node), 5)

End If

End Sub

Read Full Post »

How to control page flash

Sometimes we use navigation controls ( like treeview) on our page and the page gets flashed every time we do something on the navigation control ( clicking the treenode or expanding the treenode) . It might be annoying you sometimes. One easy way is to use meta tag in your page.

<meta http-equiv=”Page-Exit” content=”blendTrans(Duration=0.01)”>

It will control the page flash to some extent.

Note: You can set any value to Duration attri

Read Full Post »

Adding scrollbars to the table

<div style=”overflow-Y:auto; overflow-X:auto; width=300px; height=200px”>

<table>

<tr><td>….</td></tr>

.

.

.

</table>

</div>

Read Full Post »

Loading Enum values to combobox

cbo.DataSource=System.Enum.GetNames(typeof(Enumtype));

(or)

cbo.Items.AddRange(System.Enum.GetNames(typeof(Enumtype)));

Note: If we use the second approach, we can also insert other items after filling the combox with Enum valuse like .. cbo.Items.Insert(0,”<<Select>>”);

Hope it helps!

Read Full Post »