获取数据列表的数据键值 [英] Get Datakey value of datalist

查看:239
本文介绍了获取数据列表的数据键值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,
我正在使用数据列表

Hello Friends,
I am using Datalist

<asp:DataList ID="dlCategories" runat="server" DataKeyField="KBCategoryID" RepeatDirection="Horizontal" RepeatColumns="5" >
            <ItemTemplate>
<div style="padding:15,15,15,15;font-size:10pt;font-family:Verdana">
<div style="font:12pt verdana;color:darkred">
<i><b><asp:LinkButton ID="lnkTitle" runat="server"

        Text= '<%# DataBinder.Eval(Container.DataItem, "Title")%>'

        style="text-decoration:none;" onclick="lnkTitle_Click" />
</i></b>
<asp:Label ID="lblspace" runat="server" Width="50px" Text="" />
</div>
</div>
</ItemTemplate>
        </asp:DataList>


我想在单击链接按钮时检索DataKey的值.

请帮我解决这个问题.


I want to retrieve the value of DataKey on click of link button.

Please help me out of this.

推荐答案

int i = DataList1.DataKeys[dataListItem.ItemIndex];


试试这个,希望你能得到


try this i hope u will get


这篇关于获取数据列表的数据键值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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