dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersPhagu Mahato
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Resources » Code Snippets » ASP.NET GridView

How to set focus in a GridView


Posted Date:     Category: ASP.NET GridView    
Author: Member Level: Gold    Points: 5


Set Focus to TextBox in GridView when click on Edit



 


set focus in a GridView
Some time we have requirement to set focus in gridview,so here i am describing to how to this.
Drag and drop a gridview and bind it according to below code.


protected void GridViewIns()
{
try
{
Ds = objBLL.GetData();
if (Ds.Tables[0].Rows.Count > 0)
{
gvIns.DataSource = Ds;
gvIns.DataBind();
}
}
catch (Exception ex)
{
Message.Text = ex.Message;
}
}
protected void gvInst_RowEditing(object sender, GridViewEditEventArgs e)
{
gvIns.EditIndex = e.NewEditIndex;
GridViewIns();
gvIns.Rows[e.NewEditIndex].FindControl("txtIns").Focus();
}
protected void gvIns_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvIns.PageIndex = e.NewPageIndex;
GridViewIns();
}





Did you like this resource? Share it with your friends and show your love!


Responses to "How to set focus in a GridView"
Author: Pal (Parthiv) Patel    26 Jul 2010Member Level: Gold   Points : 1
hey buddy nice code.

it's really good.

i like it man

keep it up and share all this type of good codes to use.

Regards::

Pal(Parthiv) Patel

Computer Tips & Tricks

Asp.net Tips & Tricks



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: HyperLink column in gridview
    Previous Resource: Gridview no record found display empty grid(When Gridview add new row in footer)
    Return to Resources
    Post New Resource
    Category: ASP.NET GridView


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Set Focus to TextBox in GridView  .  



    Follow us on Twitter: https://twitter.com/dotnetspider

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.