-1

我在母版页中使用中继器控件,单击时我想过滤默认页面中的行。

怎么可能请建议我。

请看这张图片检查链接。

https://lh5.googleusercontent.com/-lf-adg89UEg/UoMznxjG10I/AAAAAAAAA8w/15UzfnLEGL8/w901-h722-no/POST2.jpg

4

2 回答 2

0

尝试这个:

<asp:Repeater ID="itemRepeater" runat="server" OnItemCreated="itemRepeater_ItemCreated" >
<ItemTemplate>
<tr>
 <td colspan="2">
 <asp:Button ID="phImage" runat="server"  OnCommand="Category_Click" CommandName="CategoryClick" CommandArgument='<%# Eval("CategoryID") %> />
 </td>
  </tr>
 </ItemTemplate>  
 </asp:Repeater>



protected void Category_Click(object sender, CommandEventArgs e)
{
    if (e.CommandName == "CategoryClick"){
        //e.CommandArgument -->  Categoryid value

int categoryid=Convert.ToInt32(e.Commandargument)
        //Do something
    }
}
于 2013-11-13T08:42:34.943 回答
0

在母版页Repeater控件上创建Repeater ItemCommand事件并在这样的事件上获取类别ID

protected void rptcategory_ItemCommand(object source, RepeaterCommandEventArgs e)
{
 Response.Redirect("default.aspx?cateid=" + ((LinkButton)e.CommandSource).Text);
}

在默认页面上从页面加载事件字符串的查询中获取选定的类别 ID,例如

if (Request.QueryString["cateid"] != "")
{
   //get selected category id on default page and run filter query 
   //Request.QueryString["cateid"];
}
于 2013-11-13T08:58:27.447 回答