473,320 Members | 1,876 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,320 software developers and data experts.

Problem in data grid in ASP.Net 2003

Hi Everyone,

I have two fields in data grid i.e. ID and DESCRIPTION. Description field is a link button and ID field is hidden. I want that when I click on description field then another page should be open on the basis of ID field value. How can I get the value of ID field in query string. Keep in mind that ID is a hidden field. Can anyone solve my problem
Nov 5 '08 #1
1 957
nateraaaa
663 Expert 512MB
Hi Everyone,
I have two fields in data grid i.e. ID and DESCRIPTION. Description field is a link button and ID field is hidden. I want that when I click on description field then another page should be open on the basis of ID field value. How can I get the value of ID field in query string. Keep in mind that ID is a hidden field. Can anyone solve my problem
I think the easiest way to accomplish this would be to use the CommandName and CommandArgument properties of the LinkButton.

[HTML]<asp:LinkButton ID="lnkButton" Runat="server" CommandArgument='<%# DataBinder.Eval(Container,"DataItem.ID")%>' CommandName="Details"></asp:LinkButton> [/HTML]

Then in the ItemCommand event of your datagrid you can check the value of e.CommandName and then open the page you want with a querystring value = to e.CommandArgument

Expand|Select|Wrap|Line Numbers
  1. public void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e)
  2.         {
  3.             if(e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Pager)
  4.             {
  5.                 if(e.CommandName == "Details")
  6.                 {
  7.                     Response.Redirect("NewPage.aspx?value=" + e.CommandArgument);
  8.                 }
  9.             }            
  10.         }
Nov 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Peter | last post by:
Does anyone have an example of how to format VS 2003 Data Grid that looks like the example below? I want the data to be grouped by the Date Field and display one date for each group of dates and...
3
by: Matthew Woods | last post by:
Hi, is there any way to format and order the columns displayed in a datagrid bound to a class that inherits from IBindingList? i have used DataGridTableStyle and added DataGridTextBoxColumns to it...
0
by: Steve | last post by:
Hi I have a db with 2 tables that I want to bind to a grid depending on a selection in a Dropdownlist Also I want to be able to select a row from the gris to fill some textboxes. The databases...
3
by: Harry Whitehouse | last post by:
Hi! Today I coded a small ASPNET page which accepts a 5 digit ZIP code and will return all the street names in that ZIP code. You can try it out here: ...
4
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
1
by: Josh | last post by:
Using Visual Studio 2003, C#, .NET 1.1. I have a web form with a few textboxes, a couple of dropdown lists, and a data grid. The data grid is populated from a SQL stored procedure. The user...
1
by: Stephen Plotnick | last post by:
I have a checkbox in a data grid that does not change it's state until I actually leave the field. I've done this routine several times in other data grids without an issue. I'm using VB.2003. ...
12
by: NOO Recursion | last post by:
Hi everyone! I am trying to write a program that will search a 12x12 for a thing called a "blob". A blob in the grid is made up of asterisks. A blob contains at least one asterisk. If an...
4
by: RoMo | last post by:
I am using VB .NET (2003) for a project that includes a datagrid on one form that allows the user to switch to details on a second form. The datagrid was built in design mode with all the proper...
2
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.