Select a row in GridView and show dependent Values in Other GridView on the basis of selection...

hi, i've a parent table which has many values in it.. i also have some child tables which contains other information.. these tables are linked through forein keys... now what i want to do is, i want to select a value from main table suppose, ID 10, and i want to display it in other gridview having the children table values of the ID 10. how can i achieve this scenario?
Please let me know if i am not clear with my statements.
Thank U


-Jigzy-

Please remember to click “Mark as Answer” on the post that helps you.

This can be beneficial to other members reading the thread.
0
Jigzy
8/15/2008 1:44:26 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

8 Replies
1476 Views

Similar Articles

[PageSpeed] 28

You can have your ID column as DataKeyNames="ID" on the gridview.

<asp:GridView ID="Gridview1" runat="server" DataKeyNames="ID"

<asp:BoundField DataField="ID"   Visible="false" />

if you use select command of the gridview then use the follwoing method to grab your row id.

protected void GridView1_SelectedIndexChanged(Object sender, EventArgs e)
    {
        int i  = GridView1..DataKeys[e.rowindex].value.toString();
    }

Subash

0
subashsagar
8/15/2008 2:01:32 PM

You are looking for the implementation of the HierarGrid? If it is here is best article

http://aspalliance.com/articleViewer.aspx?aId=21&pId=

Hope this what u r looking for. Good luck

 


Please Don't forget to click "Mark as Answer" on the post that helped you.
This can be beneficial to other community members reading the thread.
0
cv_vikram
8/15/2008 2:04:03 PM

subashsagar:

You can have your ID column as DataKeyNames="ID" on the gridview.

<asp:GridView ID="Gridview1" runat="server" DataKeyNames="ID"

<asp:BoundField DataField="ID"   Visible="false" />

if you use select command of the gridview then use the follwoing method to grab your row id.

protected void GridView1_SelectedIndexChanged(Object sender, EventArgs e)
    {
        int i  = GridView1..DataKeys[e.rowindex].value.toString();
    }

Subash

 

 

i'm getting the error here..

 

protected void GridView1_SelectedIndexChanged(Object sender, EventArgs e)
    {
        int i  = GridView1..DataKeys[e.rowindex].value.toString();
    }

 

what should i do?


-Jigzy-

Please remember to click “Mark as Answer” on the post that helps you.

This can be beneficial to other members reading the thread.
0
Jigzy
8/15/2008 2:14:05 PM

actually i'm not looking for this Smile. Thank u for posting.

cv_vikram:

You are looking for the implementation of the HierarGrid? If it is here is best article

http://aspalliance.com/articleViewer.aspx?aId=21&pId=

Hope this what u r looking for. Good luck

 


-Jigzy-

Please remember to click “Mark as Answer” on the post that helps you.

This can be beneficial to other members reading the thread.
0
Jigzy
8/15/2008 2:15:23 PM

Please post your code and gridview html text and I can help you in acheiving your task.

0
subashsagar
8/15/2008 2:26:54 PM

subashsagar:

Please post your code and gridview html text and I can help you in acheiving your task.

 

ok heres my Gridview Code..

 

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"

AutoGenerateColumns="False" DataKeyNames="JobseekerID" DataSourceID="SqlDataSource1"

Font-Bold="False" Caption="Resume Table" CaptionAlign="Top" CellPadding="3" Font-Size="XX-Small" HorizontalAlign="Center" RowHeaderColumn="ResumeTitle" OnSelectedIndexChanging="GridView1_SelectedIndexChanging" SelectedRowStyle-BackColor="#fffff0">

<Columns>

<asp:CommandField ShowSelectButton="True" />

<asp:BoundField DataField="Username" HeaderText="Username" SortExpression="Username" />

<asp:BoundField DataField="ResumeTitle" HeaderText="Resume Title" SortExpression="ResumeTitle" />

<asp:BoundField DataField="First" HeaderText="First Name" SortExpression="First" />

<asp:BoundField DataField="Last" HeaderText="Last Name" SortExpression="Last" />

<asp:BoundField DataField="Gender" HeaderText="Gender" SortExpression="Gender" />

<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />

<asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" />

<asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />

<asp:BoundField DataField="Mobile" HeaderText="Mobile" SortExpression="Mobile" />

<asp:BoundField DataField="Religion" HeaderText="Religion" SortExpression="Religion" />

<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />

<asp:BoundField DataField="Objective" HeaderText="Objective" SortExpression="Objective" />

</Columns>

</asp:GridView>

 

my Primary Key is JobseekerID, i want to select all the values from other tables that has value equal to JobseekerID to another gridviews and there are 8 tables that are depending upon this Resume Table.. how can i achieve this?


-Jigzy-

Please remember to click “Mark as Answer” on the post that helps you.

This can be beneficial to other members reading the thread.
0
Jigzy
8/15/2008 2:33:11 PM

actually i found an answer and it solved my problem


-Jigzy-

Please remember to click “Mark as Answer” on the post that helps you.

This can be beneficial to other members reading the thread.
0
Jigzy
8/15/2008 2:55:12 PM
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 

{

Label2.Text = GridView1.SelectedRow.Cells[1].Text.ToString();

}

 

This helped me in achieving my Goal.... Thanks all for replying..


-Jigzy-

Please remember to click “Mark as Answer” on the post that helps you.

This can be beneficial to other members reading the thread.
0
Jigzy
8/15/2008 2:57:02 PM
Reply:

Similar Artilces:

How to bind gridview depending on the selected value of dropdownlistbox present in same gridview.
I have a gridview, in that ihave dropdownlistbox as acolumn. Depending on the selected value of dropdown list box i want to bind the grid view. I know the concept that we need to bind the grid in selected index change of dropdownlistbox, But i am not getting the dropdownlistbox inside the selectedindex changed event of dropdownlistbox. How i can get the selectedindex of dropdownlistbox present in gridview.  Use the sender parameter to retrieve a reference to your DropDownList like so: protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)...

Selecting a gridview row and keeping the last selected row in a gridview highlighted after mouse moves over a new row.
What is the best way to show a gridview row highlighted once selected and keep it highlighted once the mouse moves over a different row? Thanks, Steve hi,you can use <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="#FFFFFF" /> plz let me know if i misunderstood you Thanks for your help. One problem; however, is that after the row has been selected and I check the "grid.SelectedIndex" it has a value of -1 and not the index of the row that was selected on the grid. What do you recommend? Thanks, Steve hi, sorry i din...

Selecting a value from a gridview selected row
i am trying to select a value from a selected row in a gridview. the value i want to select is "workordernumber"  i have the gridview displaying a list of work orders.  the list changed depending on whether or not the person has chosen to view open, closed or all work orders.  if i am view just the open or closed work orders it is obviously not showing every single work order number and there are some gaps in there.  when i try to select the value of the work order number cell with the select button it is acting kinda funky.  it is selecting the index value instead o...

Iwant to select a row and column in gridview with select radiobutton. but No checked change event.below put a button .if click that button to seleced row values will select
I want to select a row and column in gridview using radiobutton in gridview . if which radio button is select that row will select and i want that row column values in outside individual textboxes of next page.  but in that only single radiobutton will select and no post back="true" bcz iam not using checked change property. i inserted button below gridview. if i click the that selected row and columns values are stored into textboxes of next page im using this code .but im getting one column in that row. but i want all columns in that selected row so plz repla...

Selecting the multiple rows in GridView and inserting the selected rows to another Gridview & Performing some operations on it
 Dear All, I have become mad for solving this problem. Please Help me. I have a Gridview bound to a datasource. I inserted the CheckBox Control in Templet to select certain rows. Gridview1 contains some products id & name.I want to insert the selected rows in to second Gridview  and in the second Gridview I need to add two more colums AdvicedQty & AcceptedQty(TextBox Cotrol).The user will select few products in Gridview1 & clicks add which will be added another gridview then in second Gridview he enters the AdviceQty & AcceptedQty.After entering the data he cli...

Problem in Using DropDownList Control to select a selected row of SqlDataSource that is under GridView Control
Hi all,In my SQL Server Management Studio Express, I have a database "ChemDatabase" that has a table "LabData"  formatted in the following way: SampleID int PRIMARY KEY, SampleName nvarchar(25), ChemicalName, nvarchar(25), Concentration decimal(6.2) with 5 rows of records in this .dbo table. In my Visual Web Developer Express, I created a website "RPD-TCE" for extracting a row of record from the LabData table by using a DropDownList, a GridView and a SqlDataSource.  I want to click DropDownList to list one number of S...

Gridview paging enabled. Has checkbox to select the row . If user select the checkbox on one page and move to 2nd page to select the rows there also to export the selected rows to excel. But doing so
HiI am using Gridview and that has paging enabled. Using checkbox to select the particular row of the gridview to export the selected rows to the excel . Everything is working fine except for one case.Let user selected the "check" box for, five rows which user would like to export to excel (two of rows on page 1 of results and 3 of them on page 2 of results), however it only exports the 3 row details from page 2, because it seems to de-select the 2 rows from page 1 when I move to page 2 and vice versa. The code i am using is as :protected void BtnExcel_Click(object sender, EventArg...

How to access the row cells value of gridview on Select button click in Gridview
Hi Friends I am trying to getting the Row cells value on the Select command click. PLz any one know then reply me.  just add the code below between <Columns> element<asp:CommandField ShowSelectButton="True" />  then in you code add GridView1_SelectedIndexChanging events . inside the events you can get te id either  by writig id=GridView1.SelectedRow.cells[0].tostring or temp string= ctype(GridView1.Rows(e.NewSelectedIndex).FindControl(controlname),label)).textnote : assume that the ID is handled by label control in your datagrid.good luck&quo...

How to retrieve data row and hiddenField values in <TemplateField> GridView and show it in a TextBox by clicked on each row not Select Command button
asp:GridView ID="GridviewHelpdesk" DataSourceID="srcTransfers" DataKeyNames="IDHelpdesk"    AutoGenerateColumns="false" GridLines="Horizontal" runat="server" AllowPaging="true"    BorderWidth="0px" BackColor="White" CellPadding="2" CellSpacing="0" BorderStyle="None"    BorderColor="#CCCCCC" Font-Names="Arial" PagerSettings-Position="Bottom" PagerSettings-Mode="Numeric"    Pag...

new row below selected row in gridview to display child gridview
Hello,   I have a gridview that up selected..shows the nested child grivdview. The problem I currently have is that it stuffs all the data into a column whcih blows the whole tbale out of whack. What I need to do is create a new row below the sleected row to house the new child grivdview. I have seen third party controls do this such as teleriks radgrid but I wont to do this with the gridview control.  Any articles on how to do this? Does AJAX support this? Any help is greatly appreciated.    ...

select a row in gridview when focus it in gridview
i did that :        e.Row.Attributes.Add("onMouseOver", "this.style.background='#E2DED6';");        e.Row.Attributes.Add("onMouseOut", "this.style.background='#F7F6F3';");       e.Row.Attributes.Add("onclick", this.GetPostBackClientEvent(GridView2, "Select$" + e.Row.RowIndex.ToString()));       with this code my gridview will have colour distinct on the row where mouse position are, and when you click will select the row clicked. i want to navigate in gridvie...

copying selected gridview row into same gridview
Kind of like a quickcopy feature??Any sugggestions?    Hi You can make use the import row functionality of grid view.RegardsRobins John It might be better to copy a row in the underlying data and then rebind GridView to the data with the new row.Steve Wellens My blog SGWellens:It might be better to copy a row in the underlying data and then rebind GridView to the data with the new row.  This does sound like the better way to do it.  How do you copy the current selected row?  It depends on what database object you are using. Basically, grab the d...

I can't get value of control in the selected row of a Gridview
I'm trying to perform an update using a sqldatasource from a gridview after a selection is made from a dropdown and a linkbutton "lbnUpdate" is clicked. I assigned  "select" as the command name of the linkbutton so I was assuming that I could then reference the gridviews selected row from the code behind but I guess I made a bad assumption. During debug there is "nothing" in the variable I use to capture the gridview selected row. I will post what I have. If I set AutoGenereateSelect button to true I can get the SelectedIndexChanged event...

Using a row selection in a gridview to create database rows for another gridview
Hi there, I have 2 gridviews on a form, the first displays some template rows from a database table.  The second displays some user specific rows (with additional data added to the template info) from the same table. They both work fine for displaying the info.  Now what I want to do, is allow users to 'select' a template row on the first gridview, and have that action automatically: create a new user-specific row, with added fields from profile data etc. insert it into the table then refresh the second gridview in order to show the new added row. C...

Web resources about - Select a row in GridView and show dependent Values in Other GridView on the basis of selection... - asp.net.presentation-controls

List of sovereign states and dependent territories by population density - Wikipedia, the free encyclopedia ...
... measured by the number of human inhabitants per square kilometre or square mile. The list includes sovereign states and self-governing dependent ...

Majority Of CEOs Say Canada Too Dependent On Alberta: Survey 15
... — said they believe the country should be less reliant on resources. A majority of Canadian business leaders believe the economy is too dependent ...

Jabil: Too Dependent on Apple, Says UBS, Prefers Flextronics
Shares of contract electronics manufacturer Jabil Circuit (JBL) are down 9 cents, or half a percent, at $19.55, after UBS’s Steve Milunovich ...

SHOCKER: Two of Three Illegal Immigrant Households Dependent on Welfare Payments
... examined welfare use by all immigrant households. The executive summary: roughly two of every three illegal immigrant households are dependent ...

$10 billion tech unicorn WeWork says it is not dependent on venture funding for its revenues
... — as well as services (healthcare, payment processing, etc.). This is interesting news, because we now know that WeWork is not dependent on ...

Fed policy 'very' data dependent: Brainard
Fed policy is very dependent on incoming data but there has already been some tightening of conditions due to the dollar, said Fed Gov Brainard. ...

A Happy Independence Day Is Supposed To Mean Not Being Dependent
Enjoy the fireworks. Be prepared to make some of your own. Aim small, miss small.

Apple Watch 2 Will Be Less Dependent on iPhones
Rumors about the coming big features in the next generation of the Apple Watch are already surfacing, including a FaceTime video camera.

Carmelo Anthony's Value and Legacy Dependent on Strong Season
FILE - In this Feb. 1, 2015 file photo, New York Knicks' Carmelo Anthony smiles during the second half of the NBA basketball game against the ...

In Alaska, Obama to ask for action against climate change in state dependent on oil
... next week to press for urgent global action to combat climate change, even as he carefully calibrates his message in a state heavily dependent ...

Resources last updated: 12/8/2015 3:47:14 PM