Solved

Load textfrom from gridview selected row

Posted on 2013-06-13
12
304 Views
Last Modified: 2013-06-13
I am trying to load textbox from selected keydown of gridview

tried both ways as under but no luck

bxtitleid.Text = dgridtitle.Item("TitleID", dgridtitle.CurrentRow.Index).Value
            tbxdescription.Text = dgridtitle.SelectedRows(0).Cells("DESCRIPTION").Value.ToString()


it was column name not valid
0
Comment
Question by:GRChandrashekar
  • 6
  • 6
12 Comments
 
LVL 42

Expert Comment

by:sedgwick
Comment Utility
that should work:
dgridtitle.SelectedRows(0).Cells("DESCRIPTION").Value.ToString()

Open in new window


FYI, make sure the column name is case sensitive.
0
 

Author Comment

by:GRChandrashekar
Comment Utility
Tried that also
0
 
LVL 42

Expert Comment

by:sedgwick
Comment Utility
what are you getting?
0
 

Author Comment

by:GRChandrashekar
Comment Utility
Column named Titleid cannot be found.
Parameter name: columnName

I copied from griddata property name and pasted so that name is right still error
0
 
LVL 42

Expert Comment

by:sedgwick
Comment Utility
when u debug your code, before this line, put dgv.Columns in the Watch window and see if the collection contains "Titleid"
0
 

Author Comment

by:GRChandrashekar
Comment Utility
It is there
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
Comment Utility
you need the Name property of the Column not the header text or the bound property.
0
 

Author Comment

by:GRChandrashekar
Comment Utility
Yes I have taken Name property of the Column
0
 

Author Comment

by:GRChandrashekar
Comment Utility
This works :
dgridtitle.SelectedRows(0).Cells("TitleidDataGridViewTextBoxColumn").Value.ToString()

But is this the way ?
0
 
LVL 42

Expert Comment

by:sedgwick
Comment Utility
where TitleidDataGridViewTextBoxColumn came from?
0
 

Author Comment

by:GRChandrashekar
Comment Utility
copied from grid view design-name
0
 
LVL 42

Expert Comment

by:sedgwick
Comment Utility
great, as long as its working
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now