.aspx设计页中如何使用代码隐藏结果​​. [英] How to use codebehind result in .aspx design page.

查看:174
本文介绍了.aspx设计页中如何使用代码隐藏结果​​.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是uday satardekar

我有一个asp.net应用程序.

我在search.aspx.cs文件的页面加载中写了数据库代码,并检索了一些结果.


现在,我必须绑定/显示包含所有HTML视图的search.aspx源中的结果


喜欢

Hi,

I am uday satardekar

I have one asp.net application.

I have write database code on page load in search.aspx.cs file and retriveing some result.


Now i have to bind/show that result in search.aspx source which contain all html view


Like

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="searchexporters.aspx.cs" Inherits="searchexporters" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html>
<head>
</head>
 
<body>
<img src="images/viewdetails.jpg" width="98" height="20" border="0">
 
</body>



我要在这里



Here i want

ds[1].tables["count"].tostring();

来自.aspx.cs文件的此值

我该如何实现?

在此先感谢.

this value from .aspx.cs file

How I can achieve this?

Thanks in advance.

推荐答案

在设计中定义标签lblcount
在获取数据后的代码后面写
in design define a label lblcount
in code behind after retrieving data write
lblcount.text=ds.tables["count"].rows[0]["Count"].toString()



如果您需要出价多于一行,则可以在aspx页面中使用gridview控件.



if you need to bid more than one row then take a gridview control in aspx page


有很多方法可以做到这一点.一种方法是使用XML HTTP Ajax概念.

以下链接对您有用.

http://www.dotnettwitter.com/2011/05/how-to-implement-xml-http-ajax-in.html [
There are many ways to do this.. one way is to use XML HTTP Ajax concept.

Below link would be useful for you.

http://www.dotnettwitter.com/2011/05/how-to-implement-xml-http-ajax-in.html[^]


在您的.cs文件中写入
in your .cs file write that
 public String returnData(){
   return ds[1].tables["count"].tostring();
}



然后在您的.aspx文件中,可以调用此函数,您可以将其放在要显示此数据的位置



Then in your .aspx file you can call this function by,You can put this where do you want to show this data

<%=returnData()%>


这篇关于.aspx设计页中如何使用代码隐藏结果​​.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆