Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Data grid

Posted on 2004-08-20
9
Medium Priority
?
414 Views
Last Modified: 2006-11-17
Hi,
  I am using a data grid(dg1) with the columns: Name(hyperlink), age, city, country. I want to display another data grid(dg2) when the user clicks on the Name column in dg1 on the same page. The data in dg2 should display the  different transactions by that specific name clicked in dg1. Can anybody help me in this matter. Its very urgent as I am working on a dead line. Thanx in advance.
0
Comment
Question by:niki_kiran
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11855097
can you post the code for dg1
0
 

Author Comment

by:niki_kiran
ID: 11855151
                             <TD>
                                    <asp:datagrid id="SearchResults" runat="server" Width="100%" BorderColor="#999999" BorderStyle="None"
                                          OnEditCommand="dg_Edit" BackColor="White" GridLines="Vertical" BorderWidth="1px" AutoGenerateColumns="False"
                                          HorizontalAlign="Justify" AllowPaging="True" OnPageIndexChanged="dg_Page" DataKeyField="CampaignID"
                                          AllowSorting="True" CellPadding="3">
                                          <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#004040"></SelectedItemStyle>
                                          <AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle>
                                          <ItemStyle ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
                                          <HeaderStyle Font-Size="8pt" Font-Names="Verdana" Font-Bold="True" HorizontalAlign="Center" ForeColor="White"
                                                VerticalAlign="Middle" BackColor="#67819E"></HeaderStyle>
                                          <FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
                                          <Columns>
                                                <asp:HyperLinkColumn DataNavigateUrlField="CampaignName"  DataTextField="CampaignName" HeaderText="Campaign Name"
                                                 Navigateurl=></asp:HyperLinkColumn>
                                                <asp:BoundColumn DataField="StartDate" SortExpression="StartDate" HeaderText="StartDate"></asp:BoundColumn>
                                                <asp:BoundColumn DataField="EndDate" SortExpression="EndDate" HeaderText="EndDate"></asp:BoundColumn>
                                                <asp:BoundColumn DataField="Description" SortExpression="Description" HeaderText="Description"></asp:BoundColumn>
                                                <asp:BoundColumn DataField="StatusID" HeaderText="StatusID"></asp:BoundColumn>
                                          </Columns>
                                          <PagerStyle Width="180px" VerticalAlign="Middle" NextPageText="&lt;IMG SRC=../Images/forward.gif&gt;"
                                                Font-Size="8pt" Font-Underline="True" Font-Names="Verdana" PrevPageText="&lt;IMG SRC=../Images/backward.gif&gt;"
                                                HorizontalAlign="Center" ForeColor="Navy" BackColor="#999999" Wrap="False"></PagerStyle>
                                    </asp:datagrid></TD>


This is the code with 5 columns. The column names are different from the ones i mentioned. Here the campaign name field is the hyperlink field. If I click that link it should display the transactions for that campaign in another data grid. Hope you got what i am looking for.
0
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11855841
can you load the transaction details based on the CampaignID?  I noticed you set that as the DataKeyField.

create a datagrid below the current datagrid and call it dg2.  when someone clicks on hyperlinkcolumn, in your click handler just bind data to dg2 based on the DataKey of the row for the column that was clicked.

sorry it took so long, i got busy with work...

-Trevor
0
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 

Author Comment

by:niki_kiran
ID: 11855878
there is no onclick even for the hyperlink column...so how can i do something when its clicked??? there is only NavigateURL event for the hyperlink column.....
0
 
LVL 8

Accepted Solution

by:
trevorhartman earned 2000 total points
ID: 11855936
use a template column instead, and create a linkbutton inside with an onclick handler
0
 

Author Comment

by:niki_kiran
ID: 11855992
hi..i think i am leaving now..will work on it from home and let u know whether it worked or not..thank you..
0
 
LVL 16

Expert Comment

by:Walter Ritzel
ID: 11856861
To solve the problem of hyperlink column doesnt have onclick event, do the following:

- in property builder, put in the field Command Name a name, like 'BINDC'.

- Create an event on dg1, the onItemCommand acessor;

- in event implementation, type this:

if (e.CommandName == "BINDC")
{
commands to bind the dg2;
}


Hope this helps,

Walter.
0
 
LVL 5

Expert Comment

by:LindzK
ID: 11857058
wont  datagrid.selectedindexchanged work for a hyperlink button ? it works for a normal button

Also, i know it's an extra link - but microsoft have a nice article on doing just what your asking

http://msdn.microsoft.com/msdnmag/issues/03/08/CuttingEdge/
0
 

Author Comment

by:niki_kiran
ID: 11882300
Thank You trevorhartman. The link button worked...sorry for getting back to u late...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question