Solved

Load textfrom from gridview selected row

Posted on 2013-06-13
12
306 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

786 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