Hi all I was designing web application in that i have two master pages Default.aspx
and Addregistration.aspx
in addregistration
i stored the data in database using SQL
and i display data in default page as a gridview
and I made my column as hyperlink in grid view
when I click that link it should go to addregistration page
how I store the data with fields and text what I type.Below is the Css for column
大家好,我正在设计Web应用程序,因为我在addregistration中有两个母版页Default.aspx和Addregistration.aspx我使用SQL将数据存储在数据库中,我在默认页面中将数据显示为gridview,我将我的列作为网格中的超链接查看当我点击该链接时,它应该去添加注册页面,我如何存储我输入的字段和文本的数据.Below是列的Css
2 个解决方案
#1
0
Handle it by javascript. Your NavigateUrl is #, and add an onclick event, Or just use an input type button to make it easier
通过javascript处理它。您的NavigateUrl是#,并添加一个onclick事件,或者只是使用输入类型按钮使其更容易
<asp:HyperLink ID="hlink" CssClass="control" runat="server" NavigateUrl='#' onclick="gotoRegistration(<%#Bind("ReferenceNo")%>)" Text='<%#Bind("ReferenceNo")%>'></asp:HyperLink>
try there to pass the ReferenceNo to the JS function, if Bind doesn't work, try Eval. and your JS
尝试将ReferenceNo传递给JS函数,如果Bind不起作用,请尝试Eval。和你的JS
<script>
function gotoRegistration(theRefNo)
{
theUrl = "~/AddRegistration.aspx?refNo="+ theRefNo
window.location = theUrl;
}
</script>
And then your Registration page read it from Query of the Request
然后您的注册页面将从请求查询中读取
#2
0
Use the Page.PreviousPage Property to get data or access controls at Default.aspx from Addregistration.aspx
使用Page.PreviousPage属性从Addregistration.aspx获取Default.aspx中的数据或访问控件
sample code in Addregistration.aspx:
Addregistration.aspx中的示例代码:
protected void Page_Load(object sender, EventArgs e)
{
Page.PreviousPage.FindControl("hlink")
}
#1
0
Handle it by javascript. Your NavigateUrl is #, and add an onclick event, Or just use an input type button to make it easier
通过javascript处理它。您的NavigateUrl是#,并添加一个onclick事件,或者只是使用输入类型按钮使其更容易
<asp:HyperLink ID="hlink" CssClass="control" runat="server" NavigateUrl='#' onclick="gotoRegistration(<%#Bind("ReferenceNo")%>)" Text='<%#Bind("ReferenceNo")%>'></asp:HyperLink>
try there to pass the ReferenceNo to the JS function, if Bind doesn't work, try Eval. and your JS
尝试将ReferenceNo传递给JS函数,如果Bind不起作用,请尝试Eval。和你的JS
<script>
function gotoRegistration(theRefNo)
{
theUrl = "~/AddRegistration.aspx?refNo="+ theRefNo
window.location = theUrl;
}
</script>
And then your Registration page read it from Query of the Request
然后您的注册页面将从请求查询中读取
#2
0
Use the Page.PreviousPage Property to get data or access controls at Default.aspx from Addregistration.aspx
使用Page.PreviousPage属性从Addregistration.aspx获取Default.aspx中的数据或访问控件
sample code in Addregistration.aspx:
Addregistration.aspx中的示例代码:
protected void Page_Load(object sender, EventArgs e)
{
Page.PreviousPage.FindControl("hlink")
}