473,396 Members | 1,785 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.

Create DataGrig ButtonColumn Dinamically

Hi gurus,

I need to create a ButtonColumn in my code for using in my datagrig. What
happens is that I create this button in code, but then when I click him,
nothing happens.
I have this in my vb code:
---------------------------------
Dim bc As New ButtonColumn
bc.HeaderText = ""
bc.Text = "See Details"
bc.CommandName = "Select"
dgMyGrid.Columns.AddAt(0, bc)

//then I have the fucntion that should run when click in button
Sub SeeDetails(ByVal Sender As Object, ByVal e As DataGridCommandEventArgs)

If e.CommandName <> "Page" Then
'Place my code here
End If

End Sub
------------------------------------

In HTML have this:

------------------------------------
<asp:datagrid id="dgMyGrid" OnItemCommand="SeeDetails"
AutoGenerateColumns="False">
......
</asp:datagrid>
------------------------------------
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
Nov 21 '05 #1
5 1267
Vko
Try to :
- add an ID to your button.
- move your code into the OnInit method.

"ruca" wrote:
Hi gurus,

I need to create a ButtonColumn in my code for using in my datagrig. What
happens is that I create this button in code, but then when I click him,
nothing happens.
I have this in my vb code:
---------------------------------
Dim bc As New ButtonColumn
bc.HeaderText = ""
bc.Text = "See Details"
bc.CommandName = "Select"
dgMyGrid.Columns.AddAt(0, bc)

//then I have the fucntion that should run when click in button
Sub SeeDetails(ByVal Sender As Object, ByVal e As DataGridCommandEventArgs)

If e.CommandName <> "Page" Then
'Place my code here
End If

End Sub
------------------------------------

In HTML have this:

------------------------------------
<asp:datagrid id="dgMyGrid" OnItemCommand="SeeDetails"
AutoGenerateColumns="False">
......
</asp:datagrid>
------------------------------------
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Nov 21 '05 #2
Vko
Try to :
- add an ID to your button.
- move your code into the OnInit method.

"ruca" wrote:
Hi gurus,

I need to create a ButtonColumn in my code for using in my datagrig. What
happens is that I create this button in code, but then when I click him,
nothing happens.
I have this in my vb code:
---------------------------------
Dim bc As New ButtonColumn
bc.HeaderText = ""
bc.Text = "See Details"
bc.CommandName = "Select"
dgMyGrid.Columns.AddAt(0, bc)

//then I have the fucntion that should run when click in button
Sub SeeDetails(ByVal Sender As Object, ByVal e As DataGridCommandEventArgs)

If e.CommandName <> "Page" Then
'Place my code here
End If

End Sub
------------------------------------

In HTML have this:

------------------------------------
<asp:datagrid id="dgMyGrid" OnItemCommand="SeeDetails"
AutoGenerateColumns="False">
......
</asp:datagrid>
------------------------------------
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Nov 21 '05 #3
Check out this article to know how to add columns dynamically to datagrid
Creating Datagrid Templated Columns Dynamically
http://www.dotnetbips.com/displayarticle.aspx?id=84
http://www.dotnetbips.com/displayarticle.aspx?id=85
--
-Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com

"ruca" <ru***@iol.pt> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi gurus,

I need to create a ButtonColumn in my code for using in my datagrig. What
happens is that I create this button in code, but then when I click him,
nothing happens.
I have this in my vb code:
---------------------------------
Dim bc As New ButtonColumn
bc.HeaderText = ""
bc.Text = "See Details"
bc.CommandName = "Select"
dgMyGrid.Columns.AddAt(0, bc)

//then I have the fucntion that should run when click in button
Sub SeeDetails(ByVal Sender As Object, ByVal e As DataGridCommandEventArgs)
If e.CommandName <> "Page" Then
'Place my code here
End If

End Sub
------------------------------------

In HTML have this:

------------------------------------
<asp:datagrid id="dgMyGrid" OnItemCommand="SeeDetails"
AutoGenerateColumns="False">
......
</asp:datagrid>
------------------------------------
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Nov 21 '05 #4
Check out this article to know how to add columns dynamically to datagrid
Creating Datagrid Templated Columns Dynamically
http://www.dotnetbips.com/displayarticle.aspx?id=84
http://www.dotnetbips.com/displayarticle.aspx?id=85
--
-Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com

"ruca" <ru***@iol.pt> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi gurus,

I need to create a ButtonColumn in my code for using in my datagrig. What
happens is that I create this button in code, but then when I click him,
nothing happens.
I have this in my vb code:
---------------------------------
Dim bc As New ButtonColumn
bc.HeaderText = ""
bc.Text = "See Details"
bc.CommandName = "Select"
dgMyGrid.Columns.AddAt(0, bc)

//then I have the fucntion that should run when click in button
Sub SeeDetails(ByVal Sender As Object, ByVal e As DataGridCommandEventArgs)
If e.CommandName <> "Page" Then
'Place my code here
End If

End Sub
------------------------------------

In HTML have this:

------------------------------------
<asp:datagrid id="dgMyGrid" OnItemCommand="SeeDetails"
AutoGenerateColumns="False">
......
</asp:datagrid>
------------------------------------
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Nov 21 '05 #5
This is ASP.NET and buttoncolumn don't have Id's.
And don't have OnInit method. Have Form_Load event.
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"Vko" <Vk*@discussions.microsoft.com> escreveu na mensagem
news:77**********************************@microsof t.com...
Try to :
- add an ID to your button.
- move your code into the OnInit method.

"ruca" wrote:
Hi gurus,

I need to create a ButtonColumn in my code for using in my datagrig. What
happens is that I create this button in code, but then when I click him,
nothing happens.
I have this in my vb code:
---------------------------------
Dim bc As New ButtonColumn
bc.HeaderText = ""
bc.Text = "See Details"
bc.CommandName = "Select"
dgMyGrid.Columns.AddAt(0, bc)

//then I have the fucntion that should run when click in button
Sub SeeDetails(ByVal Sender As Object, ByVal e As
DataGridCommandEventArgs)

If e.CommandName <> "Page" Then
'Place my code here
End If

End Sub
------------------------------------

In HTML have this:

------------------------------------
<asp:datagrid id="dgMyGrid" OnItemCommand="SeeDetails"
AutoGenerateColumns="False">
......
</asp:datagrid>
------------------------------------
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Nov 21 '05 #6

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

Similar topics

0
by: Kepes Krisztian | last post by:
Hi ! My problem is that: 1.) I want to create a frame with some buttons, and client area. If the user clicked on a button, the procedure create components on client area, and show results.
4
by: CGuy | last post by:
Hi, I have a datagrid that has one ButtonColumn which is bound to a database field. My requirement is that when the page containing the datagrid is loaded, I would like the ButtonColumn to be...
3
by: John | last post by:
The ItemCommand event not getting fired when I add both a BoundColumn and a ButtonColumn to a datagrid. When I add a ButtonColumn by itself, everything works fine, but as soon as I add a...
6
by: z. f. | last post by:
Hi, i have a datagrid with a delete button for each row in the grid. when the delete button is clicked i need to ask the user in a "confirm" message box if he's sure he wants to delete. the...
3
by: ruca | last post by:
Hi gurus, I need to create a ButtonColumn in my code for using in my datagrig. What happens is that I create this button in code, but then when I click him, nothing happens. I have this in my...
1
by: Lenin Sakthees via .NET 247 | last post by:
Hi all, I am using a datagrid to show values from a SQL table. My problem is, I want to show the details of the each row when the user clicks the 'View details' buttoncolumn. I am able to fire a...
1
by: Sathyaish | last post by:
How do you get the text of a ButtonColumn control column in a datagrid? As an example, I tried this little snippet on a test project, but it returns a null string. Private Sub...
4
by: Cesar Ronchese | last post by:
Hello. I have a WebForm that contains a Panel object. This panel, at design time is empty. When running, I need to create dinamically a Label and a WebControl (built from the same project). I...
2
by: basetta | last post by:
Hi, I need to know how I can use some objects create dinamically in vb.net form. My code creates some buttons in my windows form, then I would like to manage their click events, but I don't know...
1
by: nipe | last post by:
Hello, I'm having problem with my custom datagrid control can't fire itemcommand event. The fact is that I have to make fully cutom user control so I can't do any scripting to .aspx file. There...
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
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?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.