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

GridView Problems

Hi guys,

Can you help me with my problem?

I have 2 web forms, Home webform and Admin webform.
Each webform has 1 gridview, grdHome and grdAdmin.

I also have 1 table which has field1,field2,field3,field4,field5,field6
grdHome has 3 columns: field1, field2 & field3.
grdAdmin has also 3 columns field4,field5,field6
I have successfully created a hyperlink in grdHome's field1. It is hyperlinked in the Admin webform.

What I want to do is:

1.) when i click one record in field1, the grdAdmin in the Admin webform should only display the specific record from field 4,field 5 and field 6...


Thanks,

Please help me..
Jan 15 '08 #1
11 1206
Shashi Sadasivan
1,435 Expert 1GB
this is something to do with passing parameters and then querying the database and databinding the gridview to the data source.

Where are you facing problems?
Jan 15 '08 #2
I really don't know how to do it.. I am only new in .ASP but im pretty familiar with VB script..can you show me some codes?and where to put it?
Jan 15 '08 #3
Shashi Sadasivan
1,435 Expert 1GB
How are you filling data into your grid view (especially for the admin)?

What you would need is to refill the admin grid depending upon a certain value.
So you would only need to modify your sql query a bit to accomodate that.

Once you get that working you can use query strings, or session variable when moving to the admin page when the link is clicked.

However im not sure how this is to be done if 2 browser windows are open and you want to effectively change the data in the second browser based on what you clicked in the first one
Jan 15 '08 #4
ok..

my grdAdmin has no query.. i actually leave it blank because i am researching how to do it...

what i need to do is when i click the hyperlink in grdHome, grdADmin must display the specific record that corresponds to what records i click..

meaning to say, grdAdmin must display only 3 columns, with 1 row..

so far, i have done nothing, but i am succesful creating a hyperlink in the gridview

please help me..what i want is to display a specific record in my grdAdmin in the Admin webform..

Thanks
Jan 15 '08 #5
How can i refill the admin depending upon a certain value?
Jan 15 '08 #6
How can i refill the admin gridview depending upon a certain value?
Jan 15 '08 #7
Shashi Sadasivan
1,435 Expert 1GB
Allright,
Have you connected your application to the database?

what database backend are you using

you would need to build up a sql query like
Expand|Select|Wrap|Line Numbers
  1. select field4,field5,field6 from my table where field1 = 'avalue';
If you do not know how to connect your application to a database and query, i suggest you search the forum (and even howtos) and the internet too for this.
Jan 15 '08 #8
Thanks,

I am using SQL Server 2005 as my database.. I already connected my grdHome to it..

I am successful populating the records in grdHome..

where will I put this SQL code? this is actually what i'm thinking of..

Does the 'avalue' means that it is equal to the record I clicked?
Jan 15 '08 #9
This is my code:

<asp:GridView ID="grdHome" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource3" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="2px" style="z-index: 100; left: 57px; position: absolute; top: 216px" OnSelectedIndexChanged="grdAdmin_SelectedIndexChan ged" PageSize="5">
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="Project_name"
HeaderText="Project Name"
SortExpression="Project_name"
DataNavigateUrlFormatString="Admin.aspx?id={0}"
DataTextField="Project_Name"

NavigateUrl="Admin.aspx"/>
<asp:BoundField DataField="Project_manager" HeaderText="Project Manager" SortExpression="Project_manager" />
<asp:BoundField DataField="ITP_status" HeaderText="Status" SortExpression="ITP_status" />
<asp:BoundField DataField="Date_requested" HeaderText="Date Submitted" SortExpression="Date_requested" />
</Columns>
<RowStyle BackColor="White" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
</asp:GridView>

notice the hyperlink?it will be go to the Admin webform.. as of now my admin has gridview but it has no query.. where will i put the query?
Jan 15 '08 #10
Shashi Sadasivan
1,435 Expert 1GB
Okay..
thanks for that piece of code.
Now as you said you are using SQL Server, hopefully you are using typed datasets (ie you would have dragged and dropped tables from SQL Server onto visual studio)
where the table is created you also have an adapter associated. Right click that and choose add new query.

this should bring you to a more sql familiar area and create a parametr for the field id that you are passing from your previous form

this will appear as a method within your tableAdapter method now

Once you are in Admin.aspx

run Request.QueryString("id");
to retrive the value passed from the home grid. use this id to feed into the tabl;eAdapter method created.
Jan 15 '08 #11
Thank you sir...

:-)
Jan 16 '08 #12

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

Similar topics

3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
2
by: tacmec | last post by:
ASP.NET 2.0 (C#) application. I have a web form with a GridView, which is populated dynamically. See the code below. First time to the page, IsPostBack is false. Therefore, DisplayItems() is...
1
by: Giovanni | last post by:
Dear Friends/Gurus, I have exhausted myself and have yet no solution to the following: I have an ASP.NET 2.0 Survey type application. On a page, I have placed a GridView which is bound to an...
2
by: loga123 | last post by:
Hi All, I am using Link Button for DELETE on the gridview. When I click on DELETE link, I get the ArgumentOutOfRangeException. But...it deletes the record from table in the database. On...
0
by: JMax | last post by:
Hello! I have a GridView that has another GridView embedded in it. The embedded GridView has some complex editing features (requiring JavaScript duplicating drop down lists), so I have to use...
3
by: Jeff | last post by:
Hey asp.net 2.0 In the source I posted below, there is a GridView (look at the bottom of the script): <asp:GridView ID="gvwOnline" runat="server"> </asp:GridView> I'm trying to assign a...
8
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to...
1
by: =?Utf-8?B?SGFycnkgS2Vjaw==?= | last post by:
I have a GridView that I dynamically add columns to in code. The way that my code is written, everything works properly if I use GridView.Columns.Add to simply add the columns to the end of the...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview control with a template column that has a textbox and when the control is bound to the datasource the textbox is filled ok. I then change what is in the textbox in the gridview...
1
by: Dave | last post by:
I'm having problems getting the GridView to reliably display a large amount of data (50,000+ rows). I am working my way through the excellent book “Real World ASP.NET Best Practices” by Farhan...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
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
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.