Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Load textfrom from gridview selected row

Posted on 2013-06-13
12
Medium Priority
?
313 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:Meir Rivkin
ID: 39244529
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
ID: 39244553
Tried that also
0
 
LVL 42

Expert Comment

by:Meir Rivkin
ID: 39244569
what are you getting?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:GRChandrashekar
ID: 39244573
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:Meir Rivkin
ID: 39244599
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
ID: 39244632
It is there
0
 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 2000 total points
ID: 39244642
you need the Name property of the Column not the header text or the bound property.
0
 

Author Comment

by:GRChandrashekar
ID: 39244659
Yes I have taken Name property of the Column
0
 

Author Comment

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

But is this the way ?
0
 
LVL 42

Expert Comment

by:Meir Rivkin
ID: 39244686
where TitleidDataGridViewTextBoxColumn came from?
0
 

Author Comment

by:GRChandrashekar
ID: 39244742
copied from grid view design-name
0
 
LVL 42

Expert Comment

by:Meir Rivkin
ID: 39244811
great, as long as its working
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

916 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