English 中文(简体)
asp: listbox 控制控件定制
原标题:asp:listbox control customization

Im doing this Inform retrival 搜索引擎,在 Doc 文件中搜索某些术语,使用 Lucine.net 进行搜索,每件事情都顺利,我都会在“Asp:listbox”控制下获得搜索结果。

我设法找到了文件的名称和路径,如下图所示:

""https://i.sstatic.net/rr25W.jpg" alt="此处输入图像描述"/ >

// Using      
 lst_searchResult.Items.Add(doc.Get("title"));
 lst_searchResult.Items.Add(doc.Get("path"));

我想在列表框所选项目中做更多的操作,例如

  1. ( Download Document ) using a button .
  2. ( Send link Via Email ).

我不是对ASP.net诚实的专家, 你能指导我吗?

感谢您,感谢您

最佳回答

asp: listbox 被重编为 html 控制。 选中控件的外观被您使用的浏览器扭曲。 唯一的定制选项是设置此控件的边框/ 颜色/ crollbar 。

如果您想要更具互动性的外观, 请使用 < code> asp: listview 控制。 这样您就可以控制列表中的一行是如何完成的。 这样您就可以添加按钮、 链接等 。

在代码中您定义数据结构的代码

class SearchResult
{
   public string Title {get; set;}
   public string Path {get; set;}
}

然后将 List< searchResult> 绑在列表视图控制上。

ListView 的标记可能看起来是这样的:

<asp:ListView runat="server" ID="ListView1">
  <LayoutTemplate>
    <table>
      <tr runat="server" id="itemPlaceholder" ></tr>
    </table>
  </LayoutTemplate>
  <ItemTemplate>
    <tr>
      <td><a href= <%#Eval("Path") %> ><%#Eval("Title") %></a></td>
    </tr>
  </ItemTemplate>
</asp:ListView>

此链接显示一系列关于如何使用 ListView 控制的例子 :

http://msdn.microsoft.com/en-us/library/bb398790.aspx" rel=“no follow'>http://msdn.microsoft.com/en-us/library/bb398790.aspx

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签