c#写的网页里的程序移植到c# windows应用程序里怎么改?
aspx网页里的代码如下:<asp:DataGridID="dgAllConnections"Runat="server"AutoGenerateColumns="Tru...
aspx网页里的代码如下:
<asp:DataGrid ID="dgAllConnections" Runat="server" AutoGenerateColumns="True" width="100%" cellpadding="0" cellspacing="0">
<Columns>
<asp:TemplateColumn>
<ItemTemplate><asp:Button ID="btnConnect" Runat="server" Text="Connect" OnClick="btnConnect_Click"/></ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
对应的cs文件里的代码为:
protected void btnConnect_Click(object sender, EventArgs e)
{
RASDisplay rasDisplay = new RASDisplay();
Button btnSender = (Button) sender;
DataGridItem ob = (DataGridItem) btnSender.Parent.Parent;
int ErrorVal = rasDisplay.Connect(ob.Cells[1].Text);
if(ErrorVal != 0)
{
Response.Write(ErrorVal);
}
else
{
Response.Redirect("Default.aspx");
}
} 展开
<asp:DataGrid ID="dgAllConnections" Runat="server" AutoGenerateColumns="True" width="100%" cellpadding="0" cellspacing="0">
<Columns>
<asp:TemplateColumn>
<ItemTemplate><asp:Button ID="btnConnect" Runat="server" Text="Connect" OnClick="btnConnect_Click"/></ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
对应的cs文件里的代码为:
protected void btnConnect_Click(object sender, EventArgs e)
{
RASDisplay rasDisplay = new RASDisplay();
Button btnSender = (Button) sender;
DataGridItem ob = (DataGridItem) btnSender.Parent.Parent;
int ErrorVal = rasDisplay.Connect(ob.Cells[1].Text);
if(ErrorVal != 0)
{
Response.Write(ErrorVal);
}
else
{
Response.Redirect("Default.aspx");
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询