| |

VerySource

 Forgot password?
 Register
Search
View: 883|Reply: 9

The use of DataGrid,

[Copy link]

3

Threads

10

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-3-6 16:00:01
| Show all posts |Read mode
Click a row in one DataGrid and display its corresponding data in another DataGrid
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-5-23 18:00:01
| Show all posts
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-5-23 18:15:01
| Show all posts
Suggestion: take a look. Master-slave table representation in .NET
Reply

Use magic Report

0

Threads

8

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-5-24 02:45:01
| Show all posts
You just write the event in DataGrid1_SelectedIndexChange () and it will show another DataGrid
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 Netherlands

Post time: 2020-6-11 12:00:01
| Show all posts
Simpler

Put an iframe. Used to display detailed information

private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item
||e.Item.ItemType == ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onclick","document.frames['aa'].location.href='b.aspx?id="+this.DataGrid1.DataKeys[e.Item.ItemIndex].ToString( )+"'");
}
}
Reply

Use magic Report

3

Threads

10

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

 Author| Post time: 2020-7-14 16:15:01
| Show all posts
shenmue024
e.Item.Attributes.Add("onclick","document.frames['aa'].location.href='b.aspx?id="+this.DataGrid1.DataKeys[e.Item.ItemIndex].ToString( )+"'"); I don’t understand here either
Reply

Use magic Report

0

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-7-14 18:00:01
| Show all posts
DataGrid1_ItemDataBound event dynamically spell DATATABLE, just bind to the DataGrid below
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-16 09:45:01
| Show all posts
DataGrid1_SelectedIndexChange() event does not support DataGrid1.DataKeys[e.Item.ItemIndex].ToString(), so it won’t work
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-16 10:00:02
| Show all posts
private void dg_data_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemIndex<0) return;
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DataRowView drv = (DataRowView)e.Item.DataItem;
ID=drv["faci_code"].ToString();
e.Item.Attributes.Add("onmouseover","currentcolor=this.style.backgroundColor;this.style.backgroundColor='C2F8F8'");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=currentcolor");
To
e.Item.Attributes.Add("onclick","window.open('reservation_faci_updDel.aspx?faci_code="+ID+"&code="+Request.QueryString["code"]+"','_self')") ;
// e.Item.Attributes.Add("onclick","window.open()");
}

}

This is the first datagrid response event
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-16 10:45:01
| Show all posts
You can use ajax to do it. . .
To keep it simple, just use two datagrids. . .
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list