473,396 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Still looking for an answer

Hi
I have a web form with a Datagrid. Within the data grid I have a Column
button. If the button is of type "Linkbutton" my VB code-behind will catch
the users
"click"
However, if it is set to "Pushbutton" I am unable to trap the users
click. See code Below.
I don't understand what I am missing. why won't the
"Pushbutton" work?

VB code Behind:
Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
DataGrid1.ItemCommand
'get value of row here
End Sub

HTML:
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 80px; POSITION:
absolute; TOP: 140px" runat="server" Width="484px">
<Columns>
<asp:ButtonColumn Text="Select" ButtonType="PushButton"
CommandName="Select"></asp:ButtonColumn>
</Columns>
</asp:DataGrid>
</form>
</body>

Thanks
Brian

Nov 21 '05 #1
14 1016
Brian,

"BrianDH" <Br*****@discussions.microsoft.com> schrieb:
I have a web form with a Datagrid. Within the data grid I have a Column
button. If the button is of type "Linkbutton" my VB code-behind will
catch
the users
"click"
However, if it is set to "Pushbutton" I am unable to trap the users
click. See code Below.


Notice that there is a separate group for the ASP.NET datagrid available:

<URL:news://news.microsoft.com/microsoft.public.dotnet.framework.aspnet.datagridc ontrol>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
Yes but I am not doing ASP this is a web form run by VB code-behind? The
event would be traped by server side VB.Net code not ASP, client side code.

ButI'll try there too.

"Herfried K. Wagner [MVP]" wrote:
Brian,

"BrianDH" <Br*****@discussions.microsoft.com> schrieb:
I have a web form with a Datagrid. Within the data grid I have a Column
button. If the button is of type "Linkbutton" my VB code-behind will
catch
the users
"click"
However, if it is set to "Pushbutton" I am unable to trap the users
click. See code Below.


Notice that there is a separate group for the ASP.NET datagrid available:

<URL:news://news.microsoft.com/microsoft.public.dotnet.framework.aspnet.datagridc ontrol>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
"=?Utf-8?B?QnJpYW5ESA==?=" <Br*****@discussions.microsoft.com> wrote in
news:B4**********************************@microsof t.com:
Yes but I am not doing ASP this is a web form run by VB code-behind?
The event would be traped by server side VB.Net code not ASP, client
side code.


It's ASP.NET, not VB.NET Winforms. You better get your terminology
straightened out ; )

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #4
Lucas,

I do not see what is wrong in the terminologie from Brian, as well not in
the message from Herfried by the way.

That group is special for the Webform Datagrid, in that there is not much
difference between VBNet scripting or VBNet for Dll.

The only problem is that there are almost no answers given in that newsgroup
at least the last 4 days.

Cor

"Lucas Tam" <RE********@rogers.com>
"=?Utf-8?B?QnJpYW5ESA==?=" <Br*****@discussions.microsoft.com> wrote in
news:B4**********************************@microsof t.com:
Yes but I am not doing ASP this is a web form run by VB code-behind?
The event would be traped by server side VB.Net code not ASP, client
side code.


It's ASP.NET, not VB.NET Winforms. You better get your terminology
straightened out ; )

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 21 '05 #5
"Cor Ligthert" <no************@planet.nl> wrote in
news:OZ**************@TK2MSFTNGP10.phx.gbl:
I do not see what is wrong in the terminologie from Brian, as well not
in the message from Herfried by the way.

That group is special for the Webform Datagrid, in that there is not
much difference between VBNet scripting or VBNet for Dll.


Herfried was right to redirect the question to the Webforms group...
because the datagrid in ASP.NET functions very different than the winforms
datagrid. But I don't think the original poster realizes the difference...
or perhaps I misinterpreted his answer.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #6
"Lucas Tam" <RE********@rogers.com> schrieb:
I do not see what is wrong in the terminologie from Brian, as well not
in the message from Herfried by the way.

That group is special for the Webform Datagrid, in that there is not
much difference between VBNet scripting or VBNet for Dll.


Herfried was right to redirect the question to the Webforms group...


I didn't redirect anybody. I only provided a suggestion.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #7
I understand the difference.
However this is the only group you can find an answer in.
I Agree that it is an ASP form but all the code I am using is VB.Net server
side code behind, not code within the HTML part of the application.
So since this is the VB.Net NG I placed my question here.
But I am not a highly educated programmer I am a self-taught retired
musician looking for a little help.
I apologize if I did or said something wrong.

B

"Lucas Tam" wrote:
"Cor Ligthert" <no************@planet.nl> wrote in
news:OZ**************@TK2MSFTNGP10.phx.gbl:
I do not see what is wrong in the terminologie from Brian, as well not
in the message from Herfried by the way.

That group is special for the Webform Datagrid, in that there is not
much difference between VBNet scripting or VBNet for Dll.


Herfried was right to redirect the question to the Webforms group...
because the datagrid in ASP.NET functions very different than the winforms
datagrid. But I don't think the original poster realizes the difference...
or perhaps I misinterpreted his answer.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 21 '05 #8
Brian,

Did you load your datagrid with data?
With me did it work fine,

You can try it.
\\\
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
builddata()
DataGrid1.DataBind()
Else
builddata()
End If
End Sub
Private Sub builddata()
Dim dt As New DataTable
dt.Columns.Add("Column1")
For i As Integer = 0 To 9
Dim dr As DataRow = dt.NewRow
dr(0) = i.ToString
dt.Rows.Add(dr)
Next
DataGrid1.DataSource = dt
End Sub
Private Sub DataGrid1_ItemCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) _
Handles DataGrid1.ItemCommand
DataGrid1.EditItemIndex = e.Item.ItemIndex
DataGrid1.DataBind()
End Sub
///

I hope this helps?

Cor

"BrianDH" <Br*****@discussions.microsoft.com>
Hi
I have a web form with a Datagrid. Within the data grid I have a Column
button. If the button is of type "Linkbutton" my VB code-behind will
catch
the users
"click"
However, if it is set to "Pushbutton" I am unable to trap the users
click. See code Below.
I don't understand what I am missing. why won't the
"Pushbutton" work?

VB code Behind:
Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
DataGrid1.ItemCommand
'get value of row here
End Sub

HTML:
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 80px; POSITION:
absolute; TOP: 140px" runat="server" Width="484px">
<Columns>
<asp:ButtonColumn Text="Select" ButtonType="PushButton"
CommandName="Select"></asp:ButtonColumn>
</Columns>
</asp:DataGrid>
</form>
</body>

Thanks
Brian

Nov 21 '05 #9
Lucas

There is for the windowforms datagrid as well a special newsgroup

microsoft.public.dotnet.languages.vb.controls

However that datagrid is as well answered here.
And I see not any problems for both in that.

For draging a datagrid to a form there is no newsgroup needed.

The problems come when how you implement the language.vb code.

Just my thought

Cor
Nov 21 '05 #10
"=?Utf-8?B?QnJpYW5ESA==?=" <Br*****@discussions.microsoft.com> wrote in
news:CB**********************************@microsof t.com:
I understand the difference.
However this is the only group you can find an answer in.
I Agree that it is an ASP form but all the code I am using is VB.Net
server side code behind, not code within the HTML part of the
application. So since this is the VB.Net NG I placed my question
here. But I am not a highly educated programmer I am a self-taught
retired musician looking for a little help.
I apologize if I did or said something wrong.

I found microsoft.public.dotnet.framework.aspnet to be very helpful. Lots
of traffic there (and since it's dedciated to ASP.NET, they may know the
answer).

As for your problem with the pushbutton - I never had that problem myself.
The code I used is practically identical to yours and it works fine on my
end.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #11
Yes as a metter of fact I have working Web Application that work just fine.
Thats why I ask "what am I missing?" I started a new project, added a
datagrid, called the same web-service that another one of my projects uses.
Populated the grid with the same data, have one column with a button just
like my working application but it fails to call when the button is of type
"PushButton"
Very darn odd! I just thought i was forgetting a namespace or needed to
place a handler somewhere but I can't find anything that points to the
problem.

I will try your example and let you know !

Thanks ;-)
Brian

"Cor Ligthert" wrote:
Brian,

Did you load your datagrid with data?
With me did it work fine,

You can try it.
\\\
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
builddata()
DataGrid1.DataBind()
Else
builddata()
End If
End Sub
Private Sub builddata()
Dim dt As New DataTable
dt.Columns.Add("Column1")
For i As Integer = 0 To 9
Dim dr As DataRow = dt.NewRow
dr(0) = i.ToString
dt.Rows.Add(dr)
Next
DataGrid1.DataSource = dt
End Sub
Private Sub DataGrid1_ItemCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) _
Handles DataGrid1.ItemCommand
DataGrid1.EditItemIndex = e.Item.ItemIndex
DataGrid1.DataBind()
End Sub
///

I hope this helps?

Cor

"BrianDH" <Br*****@discussions.microsoft.com>
Hi
I have a web form with a Datagrid. Within the data grid I have a Column
button. If the button is of type "Linkbutton" my VB code-behind will
catch
the users
"click"
However, if it is set to "Pushbutton" I am unable to trap the users
click. See code Below.
I don't understand what I am missing. why won't the
"Pushbutton" work?

VB code Behind:
Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
DataGrid1.ItemCommand
'get value of row here
End Sub

HTML:
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 80px; POSITION:
absolute; TOP: 140px" runat="server" Width="484px">
<Columns>
<asp:ButtonColumn Text="Select" ButtonType="PushButton"
CommandName="Select"></asp:ButtonColumn>
</Columns>
</asp:DataGrid>
</form>
</body>

Thanks
Brian


Nov 21 '05 #12
"=?Utf-8?B?QnJpYW5ESA==?=" <Br*****@discussions.microsoft.com> wrote in
news:C9**********************************@microsof t.com:
Yes as a metter of fact I have working Web Application that work just
fine. Thats why I ask "what am I missing?" I started a new project,
added a datagrid, called the same web-service that another one of my
projects uses. Populated the grid with the same data, have one column
with a button just like my working application but it fails to call
when the button is of type "PushButton"
Very darn odd! I just thought i was forgetting a namespace or needed
to place a handler somewhere but I can't find anything that points to
the problem.

An idea - are you rebinding the datagrid on each load? I think if you do...
that may invalidate the pushbutton.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #13
Cor, you example works fine. My other application works fine. I started a
new project, with a new web form-datagrid-WS call-and code. It works fine.
My best guess is there is/was somthing messed up about that project.

Lucas, Yes that could be, but i only call for the dataset on the first load
i use the "Is Post Back" to filter my events on post back.

I am going to do a little more R&D and will post to all what error i have
made here when i am sure.

Thanks you all for the HELP!
BrianDH
P.S. you might want to see why no one eve answers over on the
Framework.Datagrid NG


"BrianDH" wrote:
Hi
I have a web form with a Datagrid. Within the data grid I have a Column
button. If the button is of type "Linkbutton" my VB code-behind will catch
the users
"click"
However, if it is set to "Pushbutton" I am unable to trap the users
click. See code Below.
I don't understand what I am missing. why won't the
"Pushbutton" work?

VB code Behind:
Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
DataGrid1.ItemCommand
'get value of row here
End Sub

HTML:
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 80px; POSITION:
absolute; TOP: 140px" runat="server" Width="484px">
<Columns>
<asp:ButtonColumn Text="Select" ButtonType="PushButton"
CommandName="Select"></asp:ButtonColumn>
</Columns>
</asp:DataGrid>
</form>
</body>

Thanks
Brian

Nov 21 '05 #14
OK, its just this one project, I have no idea why the code fails to work so
I saved my .vb files and dumped the project. Never thought to try that.

Anyway it works now!

I thank you all!

BrianDH

"BrianDH" wrote:
Hi
I have a web form with a Datagrid. Within the data grid I have a Column
button. If the button is of type "Linkbutton" my VB code-behind will catch
the users
"click"
However, if it is set to "Pushbutton" I am unable to trap the users
click. See code Below.
I don't understand what I am missing. why won't the
"Pushbutton" work?

VB code Behind:
Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
DataGrid1.ItemCommand
'get value of row here
End Sub

HTML:
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 80px; POSITION:
absolute; TOP: 140px" runat="server" Width="484px">
<Columns>
<asp:ButtonColumn Text="Select" ButtonType="PushButton"
CommandName="Select"></asp:ButtonColumn>
</Columns>
</asp:DataGrid>
</form>
</body>

Thanks
Brian

Nov 21 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
by: Kingdom | last post by:
In my data base I have a list of componet types e.g. type A - I have 8 off - type B I have 12 off etc. I'm using Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM Parts_Table") ...
687
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't...
14
by: Alan Silver | last post by:
Hello, I have spent ages trawling through Google, looking for information about global functions in ASP.NET and I'm still not clear about the best way to go about this (or not). I am writing...
8
by: _iycrd | last post by:
Specifically I need to wrap an older Win32 DLL in a managed class. I had this running with VS2003's Managed Extensions, though it required two separate classes. With C++/CLI this was supposed...
25
by: Gordon Cowie | last post by:
Wouldn't it make sense if IndexOf just threw a character not found exception instead of -1? If -1 is what you were expecting there should be a function ContainsChar that returns bool. ...
5
by: PJ6 | last post by:
I really thought they'd rewrite that buggy combo box when they released 2005. But no. I'm looking at the same piece of crap with a slightly different wrapper around it. Do they plan on getting rid...
35
by: Logos | last post by:
I asked about this a while ago, and got a great answer and a reference to http://www.javascripttoolbox.com/bestpractices/new.php. I just need to override onclick and return false. No biggie! ...
11
by: Miro | last post by:
I created an MDI form and made a child form. On the child form I set the Min / Maximize buttons to false. However when the child form displays, the minimize button and the "restore" button...
39
by: jaad | last post by:
There are literally thousands and thousands of entry about this subject but still after 6 years of looking and researching I haven't found a simple answer to a really simple question: I have two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.