.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> DataGrid >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Adding Button in DataGrid RunTime

Posted By:Rajshree       Posted Date: October 28, 2010    Points: 15    Category: DataGrid    URL: http://www.dotnetspark.com  

You can add a button in a datagrid column on runtime
 

How to add button in datagird see:-

Create a instance/object of  DataGridViewButtonColumn Class then

Initialize in COnstructor

and do that code shows below:

like if we have a object like this DataGridViewButtonColumn dgbtn;

in COnstructor:

dgbtn=new DataGridViewButtonColumn();

dgbtn.HeaderText="Demo";

dgbtn.Text="Click Me";

dgbtn.UseColumnTextForButtonValue=true;

dgbtn.Width=60;

//demodatagrid object or instance of datagrid.

 

demodatagrid.Columns.Add(dgbtn);

 

Thanks you

If any query so u can contact me thanks you


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend