Solved

Load textfrom from gridview selected row

Posted on 2013-06-13
12
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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
 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

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…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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