.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 >> Forum >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

Datagridviewtextcolumn in C#.NET windows app urgent

Posted By: Sunil     Posted Date: September 29, 2008    Points:2   Category :Windows Application
i have designed a gridview in which we added a column which header name is deduct and its rows is datagrieviewButtoncolumn and second one is header name is employee id and its rows is datagridviewtextcolumn and so on of textcontrol.

when we bind data with coding
.....
......
da.fill(ds,"tableName")
datagridview1.datasource=ds.table[0];

this code not bind with the designed gridview column, it bind at the last column with database header name.

>>>i want to bind the data with my own header name and data from database.<<<

it work when we do it manually.

Responses
Author: Faizal             
Posted Date: September 29, 2008     Points: 5   

Hi,
Why dont you give the aliases of the colum name in inside the SQL Query. Like this

select User_Name as Name, Usr_ID as UserID from tableName;

Author: Narayanan             
Posted Date: July 18, 2011     Points: 20   

Hi,
I think , Mistake in your Query....
for example"
Try this way,
Select Username,password from tbl_login.
If you use this query .you get only Two columns in your grid view.But In your first Column is Button So you modify your query like this...
Select '' as [your Col name],Username,password from tbl_login.
Regards,
Lakshmi Narayanan.s




Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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