Thursday, August 30, 2007

Tree View in Dropdownlist

We all are very much aware of the DropDownList(a server control available in asp .net), the way it functions and the way the data are listed in it.

eg .,

There is another server control available which is "<asp:TreeView>" which gets rendered something like this


eg.,


I was wondering whether it is possible to have this tree view inside the dropdown. To start with, I tried binding the dropdown with the treeview and then with xml having various sub levels but I couldn't make up.



So I tried combining the available controls which will produce the look and feel of a drop down box with a tree view. A textbox, button(probably loaded with down arrow image) and a treeview were chosen. To make it behave like a dropdown, the visibility of the div which contains the tree view can be controlled.


eg.,

protected void downArrowButton_Click(object sender, EventArgs e)
{
treeViewDiv.Visible = true;
}


Now, we have have a list of items displayed in a tree like structure when the down arrow button is clicked. And when any option is selected the text box should be loaded with it and the tree structure should not be visible in order to make it behave like a drop down box. The code goes something like this,



protected void stateTreeView_SelectedNodeChanged(object sender, EventArgs
e)
{
if (sender.GetType().ToString().EndsWith("TreeView"))
{
cityTextBox.Text = stateTreeView.SelectedNode.Text;
treeViewDiv.Visible = false;
}
}


This code can further be customised as per one's requirement and can even Ajaxify certain things for better user experience.


The final output which i got was something similar to this,




Makkals, this was my long time plan(to post some technical thing). Kindly bare with me.....

அரசியல்ல இதெல்லாம் சகஜமப்பா!!!!!!



Tuesday, August 7, 2007

குரங்கு மனசு!!!


Unlike any other day, she found that the city bus was literally struggling to creep down the city streets buzzing with traffic. After travelling for few miles she managed to get a window seat and started relaxing. As the bus started moving away from city she can feel the breeze and started thinking about how bad was her day at office and all that.


Her thought was suddenly disturbed by a sight at the road side. She saw a woman equivalent in her age digging the ground for some constructional purpose. On seeing this, she very strongly felt that her work is not as hard as what she saw. She felt quite relieved and pride of her achievements and her social status. She has always been a bright student all through her life and got a pretty descent job which she intended for. Till now she has been performing her duties so much religiously that she is playing so much roles like an affectionate wife, caring mom of two kids, responsible employee, patriotic citizen ,etc., with utmost perfection. She felt like patting her own shoulders for all these.


Just then she heard a baby crying, and lady working on the road side rushed to a nearby tree in which the baby lied in a cradle made of an old cotton cloth and lifted the tender skinned baby, patted it gently and made it to sleep again. Lady in the bus now was now like 'Come on man, work and family at the same place'. She found it was an amazing idea and felt guilty of not able to take care of her kids when she was away for work and felt the lady working on the roadside was more fortunate than she herself.