Tuesday, September 30, 2014

How to Rewrite URL in Asp.Net (Search Engine Friendly Url)

Here is a simple way to Rewrite URLs in Asp.net Using Global.asax file.

Here I presenting an important aspect Search Engine optimization technique. URL rewriting can be one of the best and quickest ways to improve the usability and search friendliness of your site.

Handling cases where you want to restructure the pages within your web application, and you want to ensure that people who have bookmarked old URLs don't break when you move pages around. Url-rewriting enables you to transparently forward requests to the new page location without breaking browsers.

Normal URL: http://site.com/Default2.aspx?Coursename=Asp.net&CourseID=12
SEO friendly URL :http://site.com/IT-Training/Asp.net/12

Wednesday, September 24, 2014

How To return String into Delimited String in SqlServer and With Good Example Using "IN Clause"



As we know sql queries are Dynamic and Nondynamic queries.This example is for Non dynamic query.


For spliting string into delimited string we use Function in sql server .


Ex: @string nvarchar(max),
       @splitedstring nvarchar(max)
       set @string='word1,word2 '
       Result:@splitedstring ='word1','word2'


Saturday, September 20, 2014

How to Retrive Dynamically Generated Textboxes values using JavaScript in Asp.Net

After generating texboxes dynamically as shown in my previous artical(ClickHere to see) it is the time to retrive values of textboxes entered by the user .

In .aspx Page 

In continuation of my previous artical (ClickHere to see) add following html code in your page


 <asp:Button runat="server" ID="btnGetValues" Text="GetValues" OnClick="btnGetValues_Click" />

Adding Textbox Dynamically Using JavaScript in Asp.Net

Adding Textboxes Dynamically using Javascript is very easy in Asp.Net

In .aspx page

Add following javascript in Head Section of your page 

 function GetDynamicTextBox() 
{
            return 'TextBox1:<input name = "txt1" style="width:200px" type="text" />'+
            'TextBox2:<input name = "txt2" type="text" style="width:200px" />' +
            '<input type="button" value="Remove"  class="button"  onclick = "RemoveTextBox(this)" />'
 }

Friday, September 19, 2014

Difference between ViewData and ViewBag In MVC

ViewData ,ViewBag and TempData

When passing information from an action method to a view, you basically have three options:

1. Use the ViewDatadictionary
2. Use  ViewBag(starting in MVC 3)
3. Use a strongly typed view with a view model object


Friday, September 12, 2014

Adding FaceBook and other Social Networking Share Button In Page Using Asp.net

In aspx page

Add following html makup where you want to show facebook share button in your page,not only facebook in below markup their are other social sharing sites are there in which they are added to your webpages.


 <div class="addthis_toolbox addthis_default_style addthis_32x32_style">

                                        <a class="addthis_button_facebook"></a>
                                        <a class="addthis_button_linkedin"></a>
                                        <a class="addthis_button_twitter"></a>
                                        <a class="addthis_button_pinterest_share"></a>
</div>