COME ONNNNNNNNNN

G

Gerry A

I've asked this 5 times today.
Please help.
Should be the First thing ASP.net should do

Hi.
I can't figure this one.
How to I get the value out of column3 "Item Price" in a gridview?
It's in the row I select.
 
R

Roy

I'm assuming you're attempting to edit the gridview?

Research (in the codebehind) in the edit gridview sub the OldValue and
NewValue functionality. They will allow you to narrow down to a single
value.
 
K

Ken Cox - Microsoft MVP

Try this?

Ken
Microsoft MVP [ASP.NET]

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
If Not IsPostBack Then
GridView1.DataSource = CreateDataSource()
GridView1.DataBind()
End If
End Sub

Protected Sub GridView1_RowCommand _
(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs)
Dim gdvRow As GridViewRow
Dim gdvCell As TableCell
gdvRow = GridView1.Rows(e.CommandArgument)
gdvCell = gdvRow.Cells(2)
Response.Write(gdvCell.Text)
End Sub

Function CreateDataSource() As Data.DataTable
Dim dt As New Data.DataTable
Dim dr As Data.DataRow
dt.Columns.Add(New Data.DataColumn _
("IntegerValue", GetType(Int32)))
dt.Columns.Add(New Data.DataColumn _
("StringValue", GetType(String)))
dt.Columns.Add(New Data.DataColumn _
("CurrencyValue", GetType(Double)))
dt.Columns.Add(New Data.DataColumn _
("Boolean", GetType(Boolean)))
Dim i As Integer
For i = 0 To 5
dr = dt.NewRow()
dr(0) = i
dr(1) = "Item " + i.ToString()
dr(2) = 1.23 * (i + 1)
dr(3) = (i = 4)
dt.Rows.Add(dr)
Next i
Return dt
End Function

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Get the value of a column</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:gridview id="GridView1" runat="server"
autogenerateselectbutton="True" onrowcommand="GridView1_RowCommand">
</asp:gridview>

</div>
</form>
</body>
</html>
 
R

Roy

Then you need to research the oldvalue/newvalue functionality in the
code-behind.


From: Gerry A

No, I'm trying to get the value of the cell.
 
H

HK

Maybe if you asked with more detail, and if you waited patiently, you'd get
help.

Other people posted questions yesterday and you don't see them whining 4
more times within hours that none of the UNPAID helpers in this forum aren't
yet replying. People reply to what they can understand and to what they
know the answers, and often in a first come, first served order. If you
don't like the way the free system of people-helping-people works in a
newsgroup, then you can always call Microsoft and part with $250.

The newsgroup norm, IMO, is to wait a day or two, and then re-post with
"re-post" in the subject so people might try harder.
 
M

Mark Fitzpatrick

Also, when posting make sure you are using the correct news server. Don't
use your ISP's news server to post messages here, go directly to
news.microsoft.com. If you use your ISP's news server there's no guarantee
that they'll even end up here as the news server may or may not forward the
message here. There's only one other message in this newsgroup from a Gerry
A posted this morning. Other than that, the other three times are missing.
Give it a while as it sometimes just takes time for someone to help you. If
you post messages with a subject like this one, chances are you're going to
only anger the people that do come here and try to take the time to answer
things. Remember, nobody here is paid to answer questions.

Mark Fitzpatrick
Microsoft MVP - FrontPage
 
G

Gerry A

maybe you should donate your free time to the whiner's groups, since you
have all the answers for whiners.
 
A

Adrian Parker

looks like someone isn't going to get a great deal of help around here in future.
 
K

Kevin Spencer

well it did end up there so your point is moooooooooooooooooooot

I wouldn't be so sure of that, Gerry. You're already alienating the people
whose help you're likely to need quite often in the future, and starting to
get a reputation as someone not worth helping.

Mark is one of those people, and you would do well to take his advice. If
you start taking it now, that reputation will be aborted at birth.

Remember that, after all is said and done, you bear the responsibility for
what you get out of life and people (and newsgroups). Play to win.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A brute awe as you,
a Metallic hag entity, eat us.
 
M

Mark Rae

maybe you should donate your free time to the whiner's groups, since you
have all the answers for whiners.

I wonder how many of the regulars in this newsgroup just killfiled you (as
I'm just about to...) because of this...?
 
J

Juan T. Llibre

I didn't killfile him.

I'll wait for his next few posts before doing that, if needed.
I think he has a wonderful opportunity to learn from this experience.

It will be up to him if he does.

Kevin's post has extremely good advice for him.
 
G

Gerry A

I think the microsoft newsreader cut off your anwer to my actual question. I
don't see it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top