V J

Thursday, December 30, 2004

How to make a default button for ASP.Net Page

Dear All.. This is really a big problem. if you have couple of buttons in your form ,, and couple of input boxes or one,, how to make one button default. Lets make a scenrio, like if you have a form taking search input in a textbox, and you have one button for search, one button for sign up. You want the search button to behave like a default button,, but how.... after googling.. i found 2 methods, one is very easy just paste the code in your page load event Page.RegisterHiddenField("__EVENTTARGET", "btnSearch") This makes your search button a default button.. This is cool. But i dont know somehow it doesnt solve one of friend problem, i mean he was using ,, couple of cms templates, and all those templates have couple of button, so on his case it doesnt work ,, so there is one more solution for that,, and that is with javascript Public Shared Sub SetDefaultButton(ByVal page As System.Web.UI.Page, ByVal button As System.Web.UI.WebControls.Button) SetDefaultButton(page, button.ClientID) End Sub Public Shared Sub SetDefaultButton(ByVal page As System.Web.UI.Page, ByVal clientID As String) page.RegisterClientScriptBlock("MyFocus", " var defaultButton=null;function document.onkeypress(){if (defaultButton==null window.event.keyCode!=13) return; defaultButton.click();window.event.returnValue = false;return false;}") page.RegisterStartupScript("setDefault", "defaultButton = document.all['" + clientID + "'];") End Sub ' Blog doesnt allow to write script tag so thats why i write ssss within the code ,, change it to script. And paste the following code in your page load event SetDefaultButton(Me.Page, btnSearch.ClientID) This works everywhere, ..................................., Wajahat Abbas

Wednesday, December 15, 2004

How to create & passes Web Services Objects {XSD}

Hello All, Now this time, with a topic about passing and consuming objects b/w subscriber (the one who is using you Web Service) and the provider (the one who expose Web Service). How can they able to pass objects just like the way we passes, consumes objects in windows, web application. Well for Web Services, as you all know that data is passing over http over soap, so your object must be xml searlize object. But how to create a searlize object. Like the way if i want to create a Student object with two attributes FirstName and LastName, what i have to do,,,

  1. Create a new file (xsd dataset)
  2. Now add a element here, you will see others 2, but select element.
  3. Name that element to Student
  4. Now write FirstName in the input box and select string data type
  5. Enter LastName and select string again
  6. You can also switch to the XML window, in which you will see all the xml of this, what it do, its create an xml searlize object with Student having 2 attributes.
  7. In this manner you have created an Web Service, but you your client cant consume it, you have to do little effort more.
  8. Open you vs.net command prompt and browse the directory where your Student.xsd file is placed
  9. Run this command xsd /l:VB /classes Student.xsd
  10. This command creates a vb class for student
  11. Now back to your web service and expose any method in which you instantiate or take this student class as input args
  12. You will see that this object will contains those 2 attributes
  13. Anyone consuming your this Web Service page will able to consume this object and can fill the data into your developed object.

You have noticed that how easy to create and expose your objects in Web Services. About the back-end work, that how soap and .net managaes, all this, its kust creates a series of http commands overs soap which feels like an Object for you, however originally its not an Object.

Thats why Web Services makes life easier.

Easy ..........

Wajahat Abbas

Monday, December 13, 2004

FXCOP {Really a COP for your CODE}

Hey Guys, Here its another really smart product from Microsoft. FXCOP is a product that check's your assembly, exe, dll code for conformance to the Microsoft.Net Framework design guidelines. Like if you have developed some application and you want to check that your code is accroding to the standards {unused variables, naming convention, everything}. Just give your assembly to the FXCOP it will analyze and prepare a report which will exactly show you your every nitty gritty mistakes. This product will shipped with next version of VS.Net. Rightnow you can download it from http://www.gotdotnet.com/team/fxcop/ Install it, Run it, Enjoy .Netting, Wajahat Abbas

Wednesday, December 08, 2004

What are Smart Clients

This is once again something very innovative from Microsoft Smart Clients, a very new concept providing you the ease of both thin and thick client, while consuming services from Web Services. According to Microsoft Smart clients are easily deployed and managed client applications that provide an adaptive, responsive and rich interactive experience by leveraging local resources and intelligently connecting to distributed data sources. A smart client application combines the following ingredients to provide a responsive, rich, and compelling experience to its end users. Smart Client Ingredients Local resources and user experience Connected Offline capable Intelligent deployment and update For more details , http://msdn.microsoft.com/smartclient/understanding/definition/default.aspx

Tuesday, December 07, 2004

Teri Kasam

Hey Guys, Dont forget to listen Adnan Sami "Teri Kasam"., really a great song. Its really one of the classical song of the year (i have to say). And plz plz plz if any of you know from where i can download kindly do reply me, here or (wajahatabbas@yahoo.com), i want to download this song but dont know any website. Teri Kasam.

Sunday, December 05, 2004

C# To VB.Net Converter

Have a bunch of c# code and want to convert into VB.Net,,,,,,,,, (if you are going to do it urself, it will take a hell of time). A very cool link is there to convert ur c# code in vb.Net. Here it is http://www.developerfusion.com/utilities/convertcsharptovb.aspx Enjoy .Neting.

INETA Meeting (Pakistan Chapter)

I hope that all my INETA memebrs will be having a good meeting this Friday. I miss you all. Hope to be there on the next meeting. Wajahat Abbas

Missing you all on Weekend

Yesterday, migth be the first weekend after a year that i was not with my friends. I missed my freind, my city Karachi. As its not a weekend here in Oman, they celebrate Thrusday as a weekend, (Friday is holiday). How i celebrated Karachi weekend, here, we had a good dinner outside (no one from 3 of us know how to make the food), so we dinner outside, then we moved to home, a good movie show was going on "Sleepy Hollow", horror movie. I was half sleeping during the show. Other friends with me at Oman are Nadir bhai, and Naseem bhai. Both are my seniors from Kaslsoft, very cooperating, friendly and helping in nature. Wish to have a nice weekend after a month as we will inshalla in Karachi. Wajahat Abbas

WSE ( Web Services Enhancement )

Before Today, i was wondering that how can we secure our web services, there were multiple options like we have to pass user id and password to the subscriber which the subscriber will check and then allow us to consume, but the hurdle is that if everytime it will check will consuming it will increase it overhead. On the project for NAWRAS my PM Salim Naim asked me to implement WSE for the SMS service i developed. At First i was surprised that what is this, but after googling i came to know about this great security for Web Services. What you have to do, download WSE 2.0 from Microsoft, install, install with developer option which provide ease for VS.Net guys. Now open ur Web Service project and right click project at solution explorer, you will see a new thing WSE 2.0 at the end. Just check it out, it will appears with a new window. Now set your properties here, u have to add a user token, and a manager authentication class and as u implement it u will see a new tag in ur configuration file. Whenever a consumer will call ur service, will see a new object with WSE, like the object with name Student will become StudentWSE, implement that, now u have to consume that application with passing that token. Rest is Upto Luck, Wajahat Abbas

Moved to OMAN

Moved to Oman on a Project From Last week, i have been deployed on a Project from my office, working for NAWRAS a telecom company to be started by 2005-Feb. This project is under the supervision of MCS (Microsoft consulting services). We are around 50 devs from different countries, INDIA, Dubai, Pakistan, etc. Enjoying here with work, project is very cool and diversified, working on latest tools and technlogies. Hope that it will be delivered on time and with Perfection. Best Luck MCS, NAWRAS & KalSoft. Wajahat Abbas