我使用C#和ASP.net創建gridviews ...我需要幫助創建2個gridviews,他們有相同的processID,並從同一個數據庫中的不同SQL表獲取數據。當我點擊第一行第一個gridview應該給我在第二個gridview中具有相同processID及其細節的文件列表ASP.net中的GridViews; C#
一個進程ID有許多不同的xml文件存儲在其中 例如processID = 7A413EA4-8ECE-472D-92BE- F58C22E5C567第一gridview的 因此,所有的用戶名,日期,登錄其第二個表相同的ProcessID日的XML文件應該出現在第一表中選擇的行
這是我迄今所做的:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FS_PS2FS._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>PS2FS Client</title>
</head>
<body bgcolor="lightgrey">
<form id="form1" runat="server">
<div>
<asp:Label ID="heading" runat="server" Font-Bold="True" Font-Names="Times New Roman"
Font-Size="XX-Large" Font-Underline="True" ForeColor="MidnightBlue" Text="PS2FS CLIENT" CssClass="normal" Height="41px" Width="227px" BorderStyle="Outset" BorderWidth="5px"></asp:Label><br />
<br />
<br />
<asp:GridView ID="LOG_GridView" runat="server" AllowPaging="True" AutoGenerateColumns="False"
CellPadding="4" DataSourceID="FS_PS2FS" ForeColor="#333333" Height="300px" Width="943px" HorizontalAlign="Center" CssClass="AlternatingRowStyle" PageSize="6" SelectedIndex="0" OnSelectedIndexChanging="LOG_GridView_SelectedIndexChanging" BorderColor="#999999">
<FooterStyle BackColor="#CCCCCC" Font-Bold="True" ForeColor="Black" CssClass="normal" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" VerticalAlign="Middle" CssClass="RowStyle" />
<EditRowStyle HorizontalAlign="Left" VerticalAlign="Middle" CssClass="normal" Font-Names="Cambria" BackColor="#999999" />
<SelectedRowStyle BackColor="#FFFFC0" Font-Bold="True" ForeColor="#333333" BorderStyle="Outset" CssClass="SelectedRowStyle" BorderColor="Yellow" />
<PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999" VerticalAlign="Middle" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" CssClass="HeaderStyle" />
<AlternatingRowStyle BackColor="White" HorizontalAlign="Center" ForeColor="#284775" />
<Columns>
<asp:CommandField HeaderText="Select" ShowSelectButton="True" />
<asp:BoundField DataField="LOG_ProcessId" HeaderText="Process ID" SortExpression="LOG_ProcessId" />
<asp:BoundField DataField="LOG_Id" HeaderText="ID" InsertVisible="False" ReadOnly="True"
SortExpression="LOG_Id" />
<asp:BoundField DataField="LOG_FileName" HeaderText="File Name" SortExpression="LOG_FileName" />
<asp:BoundField DataField="LOG_Date" HeaderText="Date" SortExpression="LOG_Date" />
<asp:BoundField DataField="LOG_Description" HeaderText="Description" SortExpression="LOG_Description" />
<asp:BoundField DataField="LOG_UserId" HeaderText="User ID" SortExpression="LOG_UserId" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="FS_PS2FS" runat="server" ConnectionString="<%$ ConnectionStrings:FreightsmartWebConnection %>"
SelectCommand="SELECT [LOG_Id], [LOG_FileName], [LOG_Description], [LOG_Date], [LOG_ProcessId], [LOG_Details], [LOG_UserId] FROM [FS_LOG_PS2FS] ORDER BY [LOG_Date] DESC">
</asp:SqlDataSource>
<br />
</div>
<asp:SqlDataSource ID="PS2FS_FS" runat="server" ConnectionString="<%$ ConnectionStrings:FreightsmartWebConnection %>"
SelectCommand="SELECT [P2FV_ID], [P2FV_MessageType], [P2FV_MessageText], [P2FV_FileName], [P2FV_ProcessId], [P2FV_CreateDate], [P2FV_CreateUser] FROM [FS_LOG_PS2FS_Validation] ORDER BY [P2FV_CreateDate] DESC">
</asp:SqlDataSource>
<asp:GridView ID="LogValidation_GridView" runat="server" AutoGenerateColumns="False" CellPadding="4"
DataSourceID="PS2FS_FS" ForeColor="#333333" Height="300px" Width="940px" AllowPaging="True" HorizontalAlign="Center" PageSize="6" OnRowUpdated="LogValidation_GridView_RowUpdated" BorderColor="#999999">
<FooterStyle BackColor="#CCCCCC" Font-Bold="True" ForeColor="Black" CssClass="normal" />
<Columns>
<asp:BoundField DataField="P2FV_ProcessId" HeaderText="Process ID" SortExpression="P2FV_ProcessId" Visible="False" />
<asp:BoundField DataField="P2FV_ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
SortExpression="P2FV_ID" />
<asp:BoundField DataField="P2FV_MessageType" HeaderText="Message Type" SortExpression="P2FV_MessageType" />
<asp:BoundField DataField="P2FV_MessageText" HeaderText="Message Text" SortExpression="P2FV_MessageText" />
<asp:BoundField DataField="P2FV_FileName" HeaderText="File Name" SortExpression="P2FV_FileName" />
<asp:BoundField DataField="P2FV_CreateDate" HeaderText="Create Date" SortExpression="P2FV_CreateDate" />
<asp:BoundField DataField="P2FV_CreateUser" HeaderText="Create User" SortExpression="P2FV_CreateUser" />
</Columns>
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" BorderStyle="Outset" CssClass="normal" Wrap="True" />
<PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<EditRowStyle BackColor="#999999" />
</asp:GridView>
</form>
沒有它不是我的功課,我的工作,並就卡住不使用C#.NET IM大多是用java – sweetsecret 2010-03-25 15:46:59
酷工作!這是更多的J/K :) – 2010-03-25 15:50:19
我真的需要幫助它...因爲我卡住了,無法弄清楚該怎麼做。這是一個主/細節grdview我wud說 – sweetsecret 2010-03-25 16:51:20