Monday, February 9, 2009

Getting the list of files dragged on a control

There may be some situations in which there is a picture box sort of control and u r expected to drag image files on it to open them directly . To do so,we must deal with Drag Enter event.

In Drag Enter event just add the following code:

string[] Files = (string[])e.Data.GetData(DataFormats.FileDrop, false);

Where 'e' is the DragEventArg

The string array Files[] will contain the paths of the files dragged on to the control. After getting the files paths u can directly use them to get the desired functionality.

Friday, February 6, 2009

IMAGE SLIDING USING AJAX & JAVA SCRIPT

Take one Image and two Ajax Slider extender controls and set TargetControlID and BoundControlID' textboxes.

The design script code looks like (Note: As all you smart people know that tags are not allowed in blogspot, the starting and ending tags are replaced by '(' , ')' correspondingly)

(img id="imgZoomTarget" src="images/no daughter.bmp"

style="position: absolute;top: 92px; left: 378px; height: 343px; width: 308px" /)

(form id="form1" runat="server")

(asp:ScriptManager ID="ScriptManager1" runat="server" /)

(asp:TextBox ID="Slider2" runat="server")(/asp:TextBox)

(asp:TextBox ID="Slider2_BoundControl" runat="server")(/asp:TextBox)

(asp:TextBox ID="Slider3" runat="server")(/asp:TextBox)

(asp:TextBox ID="Slider3_BoundControl" runat="server")(/asp:TextBox)

(cc1:SliderExtender ID="heightSlider" runat="server" BehaviorID="Slider2"

TargetControlID="Slider2" BoundControlID="Slider2_BoundControl" Orientation="Vertical"

EnableHandleAnimation="true" Minimum="10" /)

(cc1:SliderExtender ID="widthSlider" runat="server" BehaviorID="Slider3"

TargetControlID="Slider3" BoundControlID="Slider3_BoundControl" Orientation="Horizontal"

EnableHandleAnimation="true" Minimum="10" /)


And now add the following java script code in body tag:


var HundredPercentHeight = 800;

var HundredPercentWidth = 800;

var controlID ="imgZoomTarget";

//Function to Modify Height according to Slider Value

function ZoomControlHeight(eventArgs)

{

var currentlyZoomingControl =$get(controlID);

//Calculate the new height

var newHeight = HundredPercentHeight * ( parseInt( eventArgs.get_Value() ) / 100 ) ;

//Assign the New Height

currentlyZoomingControl.style.height = parseInt(newHeight) +"px";

//Let go of the Control Reference

currentlyZoomingControl = null;

}

function ZoomControlWidth(eventArgs)

{

var currentlyZoomingControl =$get(controlID);

if( eventArgs.get_Value() == null)

return;

var newWidth = HundredPercentWidth * ( parseInt( eventArgs.get_Value() ) / 100 ) ;

currentlyZoomingControl.style.width = parseInt(newWidth) +"px";

currentlyZoomingControl = null;

}

function pageLoad(sender,e)

{

var sliderbehaviour = $find('Slider3');

sliderbehaviour.add_valueChanged(ZoomControlWidth);

sliderbehaviour = $find('Slider2');

sliderbehaviour.add_valueChanged(ZoomControlHeight);

sliderbehaviour = null;

}



A legend called .... RAHUL DRAVID

People call Dravid “the poor Man’s Tendulkar…” Now I know exactly what they mean. I am a fan of Sachin too, I sincerely pray for him to score at least 10 more runs whenever he reaches the 90s in a match…. but for me Rahul Dravid has always been the player I want to watch playing. It doesn’t matter to me how many matches Sachin has played or how many runs he has scored. I really don’t care about how many centuries he has got or how much ‘Man of the Match’ awards he has won. For me it has always been about The Wall- Rahul Dravid. 

I remember the Test match at Perth. Dravid and Tendulkar shared a century stand. Sachin has scored 71 runs, before was declared out lbw.Dravid had reached a 93 when he played an silly shot only to be caught by Pointing...Another century had gone begging…..I almost broke a crystal vase at home…Nevertheless I expected Dravid’s picture in the next day’s newspapers…He obviously was the performer of the day. I got his picture, but as an ‘inset’…the papers had 
a poster side picture of Sachin and an INSET of Dravid….At that moment I knew why he was called the poor man’s Tendulkar, well who cares I’m the poor man then….


“Rahul Dravid is a player who would walk on broken glass if his team asks him to….” N.S. Sidhu had once told. Maybe this was the reason why the selectors, the press and a whole nation take this ‘TEAM MAN’ for granted. If India are down in the dumpsters in a Test Match, Rahul Dravid is expected to walk out, bat the whole day under the sun, bear his cramps and save the game, but the same Rahul Dravid is not granted a second chance if he fails in one miserable ODI series. 

And then a new hero is in….Mahinder Singh Dhoni. He is the new darling of the nation. He brought home what nobody had ever done, a T-20 World Cup. People celebrated like it was India’s first ever victory in a major tournament. Them the CB series, for which people some what forgot to credit Sachin. Dhoni with his hard hit slogs, long hair, nasal voice charmed a large part of the females Cricket followers, and utterly disgusted me. I could never stand this man for
a minute. His slogs made me change the channel, no technique full power. Imagine my anguish when I heard this man was to lead the ODI team after Rahul Dravid. Then came the question of Tests. A few former Cricketers said he was not mature enough to lead in Tests, I said he’s not mature enough to lead at all. I prayed to every God I knew, ‘Let Kumble be made the Test Skipper…’ Finally my prayers were answered and Anil Kumble was named the Test Skipper. 

Dhoni showed that he had the power and chucked out two of my most favourite players in the Indian One Day team, Rahul
Dravid and Saurav Ganguly. I felt pretty sick. A team sans of Dravid and Ganguly, No more ODIs for me……….

In the recent Kitply Cup and Asia Cup, the team lost in the finals…The openers did a great job and the middle order let the team down. When the team for the Champion’s trophy was announced, Sachin Tendulkar was among the names, No Rahul, no Saurav…Apparently they are too old and the All Mighty selectors were preparing for the FUTURE, the WC 2011…..In spite of all this and the openers doing a great job, Sachin Tendulkar, an OPENER is named in the squad…Why?? Because he’s Sachin Tendulkar……….

Now I have the Test Series in Sri Lanka to look forward for. I sincerely hope ALL the seniors – Dravid, Ganguly, Laxman, Tendulkar, Kumble…do very well. Lets show Dhoni’s Cricketing KIDS what ‘REAL’ Cricket looks like…

Apparently the selectors wanted Dravid to be the second Wicket Keeper…Why..??? Because he’s Rahul Dravid, the Man who will walk on broken glass for his team. It is strange how reputed men sitting in an air conditioned room can expect
a 35 year old man to keep wickets in a Test match when not long back they marked the same man as being not fit to play a game of 50 overs….

Dhoni’s and Yuvraj’s, Raina’s and Gambhir’s may win
a number of matches for India. Sehwag might hit a half century in 2 overs. Rohit Shamra’s might dive around spectacularly saving singles…..but during my final moments if I had one last wish I would want see Rahul Dravid's graceful Straight drive followed by a colourful cover drive.