473,402 Members | 2,046 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,402 software developers and data experts.

Datagrid button

I have a Datagrid that is working fine displying my records, but I'm
trying to program buttons
on each record line to launch another web page that shows all the
details for the product:

<asp:datagrid id="dgProducts" runat="server">
<asp:ButtonColumn Text="Details" CommandName="Details"
ButtonType="PushButton"></asp:ButtonColumn>
</asp:datagrid>
Should I go to my code-behind to do something like this?:
Sub detailsClicked(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Response.Redirect("www.mysite.com\details.aspx")
End Sub
If so how can I pass the chosen record's key information into the new
page to pickup the details?
Jun 27 '08 #1
2 1345
On Jun 12, 12:42 am, brock wade <brockusw...@yahoo.comwrote:
I have a Datagrid that is working fine displying my records, but I'm
trying to program buttons
on each record line to launch another web page that shows all the
details for the product:

<asp:datagrid id="dgProducts" runat="server">
<asp:ButtonColumn Text="Details" CommandName="Details"
ButtonType="PushButton"></asp:ButtonColumn>
</asp:datagrid>

Should I go to my code-behind to do something like this?:

Sub detailsClicked(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Response.Redirect("www.mysite.com\details.aspx")
End Sub

If so how can I pass the chosen record's key information into the new
page to pickup the details?
Hi

You are taking about master detail view of course.
check out this tutorial... i believe this is what you want...
http://www.asp.net/learn/data-access...ial-10-vb.aspx

Best of luck

Munna
www.munna.shatkotha.com
www.munna.shatkotha.com/blog
www.shatkotha.com
Jun 27 '08 #2
Thanks for the link. It looks good. Let me make sure I'm on the
correct path here. I have a DataGrid and the only change I've made so
far is adding "DataTextField="Key"

<asp:datagrid id="dgProducts" runat="server">
<asp:ButtonColumn Text="Details" CommandName="Details"
DataTextField="Key"
ButtonType="PushButton"></asp:ButtonColumn>
</asp:datagrid>

The reason I used "Key" is the way the code-behind ia setup (note the
dr.Key):

Private Sub SetListViewItem(ByVal dr As Employee, ByVal dt As
DataTable, ByVal count As Integer)
If count = 0 Then
dt.Columns.Add("Emp #")
dt.Columns.Add("Last Name")
dt.Columns.Add("First Name")
dt.Columns.Add("Title")
End If
Dim EmpPos As Action = (New
ActionBroker).GetActionCurrent(dr.Key, Today, Global.UserName,
Global.UserPassword, Global.appDataSource)
Dim employee As DataRow = dt.NewRow
employee("Emp #") = dr.Key
employee("Last Name") = dr.LastName
employee("First Name") = dr.FirstName
employee("Title") = EmpPos.WorkAgainstInfo.Title
dt.Rows.Add(employee)
End Sub 'SetListViewItem

When I run the page though it says that "A field or property with the
name 'Key' was not found on the selected datasource."

Any ideas?


On Jun 12, 4:23*am, Munna <munna...@gmail.comwrote:
On Jun 12, 12:42 am, brock wade <brockusw...@yahoo.comwrote:


I have a Datagrid that is working fine displying my records, but I'm
trying to program buttons
on each record line to launch another web page that shows all the
details for the product:
<asp:datagrid id="dgProducts" runat="server">
* * * * <asp:ButtonColumn Text="Details" CommandName="Details"
ButtonType="PushButton"></asp:ButtonColumn>
* * * * </asp:datagrid>
Should I go to my code-behind to do something like this?:
* * Sub detailsClicked(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
* * * * Response.Redirect("www.mysite.com\details.aspx")
* * End Sub
If so how can I pass the chosen record's key information into the new
page to pickup the details?

Hi

You are taking about master detail view of course.
check out this tutorial... i believe this is what you want...http://www.asp.net/learn/data-access...ial-10-vb.aspx

Best of luck

Munnawww.munna.shatkotha.comwww.munna.shatkotha.co m/blogwww.shatkotha.com-Hide quoted text -

- Show quoted text -
Jun 27 '08 #3

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

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
3
by: Zürcher See | last post by:
Someone has implemented a Datagrid Button for the Windows.Form?
0
by: Shane O. Pinnell | last post by:
I am sure this has come up before, but I haven't been able to find an answer as of yet. That said, any help is definitely appreciated! I have a datagrid populated from a dataset. I have a...
3
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls...
0
by: Curtis Hatter | last post by:
I apologize if this has been answered, but on the .NET 247 site I saw a thread titled "Datagrid's ItemCommand Event", and had similar troubles with the Datagrid not properly firing the delete event...
7
by: A.M | last post by:
Hi, I want to refresh my DataGrid data on every postback. I have following code in Page_Load event, but after first page load, the DataGrid never gets refresh. Here is the code i have in...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
5
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious...
9
by: rn5a | last post by:
A DataGrid is populated with the records existing in a database. Each of the row in this DataGrid has a ButtonColumn. Assume that the DataGrid displays 10 records (i.e. 10 DataGridItems/rows). Each...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.