Solved

Load textfrom from gridview selected row

Posted on 2013-06-13
12
305 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
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:sedgwick
ID: 39244569
what are you getting?
0
 

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:sedgwick
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 42

Accepted Solution

by:
sedgwick earned 500 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:sedgwick
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:sedgwick
ID: 39244811
great, as long as its working
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

919 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

12 Experts available now in Live!

Get 1:1 Help Now