Thursday, February 24, 2011

Adding keypress event to all textboxes in asp.net using JQuery

Hi All,

Here is the quick solution to add keypress event to all textboxes in asp.net using Jquery.

How to use IsNumeric function in C#.Net

Hi all,

If we want to check a given stringg is numeric ot not we have built-in function in Vb.Net but what about in C#.Net?
I tried to build my own function in C#, here is the list of ways to achive the above functionality.
We can use any of the below method to check the given string is numeric or not.

  • Using parse method of Int:














  • Using tryparse method of Int:
  • By looping through the string arrary:
  • 
    
  • By using regular expression:








  • By using the in built IsNumeric function of visual basic:
  • 





How to Add Asp.Net Controls in XSLT ?

It is very good to know how we can add asp.net controls in XSLT.

We know by using XSLT we can transform XML document to any format like HTML, DHTML... so on.

I think most of the users are working with html controls inside the XSLT , but How to use Asp.Net Controls ?

Step 1:  Add xmlns for Asp.net

I think you kow XSLT is having stylesheet element , here we need to specify the namespace for the XSL trnsformation.
For our requirement we need to use xmlns:asp="remove"

Step 2:  Parse the asp.net Controls

You need to parse the controls in Pgae_InIt Event

Why we need to Do parsing ?

The transformed XML need to  be converted  to asp.net controls if the transformed xml is having any asp.net controls .

Note:
 Once you have transformed xml you need to replace "xmlns:asp="remove" with empty string .

Pleasee see the attached image  for your reference.











Thursday, February 17, 2011

How to find the previous page in Asp.net ?

Do you want to know what is my previous page in asp.net ?

Yes It is possible to know where your request from.

You can use Request.UrlReferrer for finding your previous page.


Now you know how to find the previous page  . happy coding :)

How to find RowIndex for gridview when textbox text is changed ?

Hi All,


If you have a textbox inside the gridview , Is it possible to find the RowIndex  with the help of ontextchanged event for textbox ?


Yes it is possible :-)


Simple steps you need to follow .


Step 1:

You need to set AutoPostBack as True for TextBox


Step 2:

You need to add ontextchnaged event for TextBox


For Example:






Step 3: 

Please add below code for you "ontextchanged" event




Tuesday, February 1, 2011

How to find Html element using multiple css class names in JQuery ?

Hi Friends I would like to share one simple concept in JQuery  :-)

How to find the particular html element using css class name in JQuery ?

 $('.cssclassname') -- For finding the element using cssclass name 

the same way how we can find for the multiple css class names ? This is very simple append the class names without spaces

$('.cssclassname1.cssclassname2........cssclassnameN') - for multiple css class name

Even you can send the dynamic class names at run time also , but remember css calss name is always between singlequote(')  with dot(.) and it should end with single quote('). refer below :-)

$("'."+DynamicCssClassName+"'")




Example:

Please find the below example I have clearly explained how to find the html elements using css class names using JQuery .


I hope you can understand the above html code : Happy coding :)