[問題] ASP gridview按鈕 開啟當行的詳細子畫面

作者: hildaz (小呆熊)   2018-03-22 11:36:57
以下是我前端的程式碼
<asp:GridView ID="GridView1" runat="server"
Width="970px" BackColor="White" BorderColor="White" BorderStyle="Ridge"
BorderWidth="2px" CellPadding="3"
CellSpacing="1" GridLines="None" AutoGenerateColumns="False"
ShowHeaderWhenEmpty="True" EnableEventValidation="false"
Visible="False"
EmptyDataText="查無資料,請用新增按鈕新增"
onselectedindexchanged="GridView1_SelectedIndexChanged" >
<Columns>
<asp:BoundField DataField="序號" HeaderText="序號"
SortExpression="序號" />
<asp:BoundField DataField="病歷號" HeaderText="病歷號"
SortExpression="病歷號" />
<asp:BoundField DataField="病患名稱" HeaderText="病患名稱"
SortExpression="病患名稱" />
<asp:BoundField DataField="建檔日期" HeaderText="建檔日期"
SortExpression="建檔日期" />
<asp:BoundField DataField="主治醫師" HeaderText="主治醫師"
SortExpression="主治醫師" />
<asp:HyperLinkField NavigateUrl="Cancerplan-edit.aspx" Text="修改
" />
<asp:ButtonField ButtonType="Button" CommandName="mys" Text="修改
" />
</Columns>
</asp:GridView>
以下是我 ButtonField的內容
想知道是否有抓取到該行序號
然後要如何修正能跳到子畫面 把對應詳細內容呼叫出來
protected void GridView1_RowCommand1(object sender, GridViewCommandEventArgs
e)
{
Response.Write("e.CommandName = " + e.CommandName+"</br>");
if (e.CommandName == "mys")
{
int i = Convert.ToInt32(e.CommandArgument);
Response.Write("e.CommandArgument=" + i);
Response.Write("第" + i + "列" + "第1格是
作者: chen5252 (鋒炮炸裂)   2018-03-26 20:36:00
跳頁?

Links booklink

Contact Us: admin [ a t ] ucptt.com