将URL绑定到数据库ID

编程入门 行业动态 更新时间:2024-10-15 08:23:08
本文介绍了将URL绑定到数据库ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图将id绑定到URL。我希望我的aspx页面上的gridview使用我在数据库中提供的ID进行过滤。我希望通过我的URL访问此过滤器(product.aspx? Id = 1 ); 我该怎么做?

解决方案

您好, 这可以帮到你... www.aspdotnet-suresh/2011/01/how-to-delete-records-in-gridview-with.html [ ^ ]

你想要实现的东西可以通过名为 Query Strings 的概念来实现。请参阅下面的链接,以便更好地了解查询字符串是什么以及如何使用它们。 ASP QueryString Collection [ ^ ] 使用QueryString在页面之间传递变量 [ ^ ] 使用C#,VB.NET中的示例在Asp中查询字符串 [ ^ ] asp QueryString示例:如何使用QueryString [ ^ ] 您将传递数据类似

Response.Redirect ( Webform2.aspx?Name = + this.txtName.Text + & LastName = + this.txtLastName.Text);

并检索数据,例如

txtBox1.Text = Request.QueryString [ 名称]; txtBox2.Text = Request.QueryString [ LastName];

1。只需将gridview绑定到sqldatasource,您可以在其中自定义查询的输入参数类型。 ex:您可以传递查询字符串或(ID)作为选择参数在SqlDatasource中。 2.如果你通过代码绑定它,即数据集或数据表,你可以在它在gridview中反映的Page_load上查询它。 DataTable.Select()方法...... 参考视图这个 [ ^ ]

Im trying to bind an id to an URL. I want the gridview I have on my aspx page to filter using the ID I gave in my database. I want this filter to be accessed through my URL ("product.aspx?Id=1"); How do I do this?

解决方案

Hi, This may help you... www.aspdotnet-suresh/2011/01/how-to-delete-records-in-gridview-with.html[^]

The thing you are trying to achieve can be accomplished through the concept called Query Strings. Refer to below links to get better idea what query strings are and how to work with the same. ASP QueryString Collection[^] Passing variables between pages using QueryString[^] Query String in Asp with Example in C#, VB.NET[^] asp QueryString example: how to use QueryString[^] You will pass data something like

Response.Redirect("Webform2.aspx?Name=" +this.txtName.Text + "&LastName=" +this.txtLastName.Text);

and retrieve data like

txtBox1.Text = Request.QueryString["Name"]; txtBox2.Text = Request.QueryString["LastName"];

1. just bind the gridview to the sqldatasource where you can customize the type of input parameter for the query. ex: you can pass the querystring or (ID) as the selectparameter in SqlDatasource. 2. if you are binding it through code i.e., Either Dataset or Datatable you can query it on the Page_load it reflects in the gridview. DataTable.Select() method... for reference view this [^]

更多推荐

将URL绑定到数据库ID

本文发布于:2023-11-02 04:00:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551312.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   数据库   URL   ID

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!