通过动态值在列表视图的每一行 [英] passing dynamic values for each row in listview
问题描述
我使用的是列表视图查看一些信息给用户那里,我用一个超链接每一行显示在特定的超链接的点击我想要什么的模式弹出的详细信息在同一页面中该行的详细报告只应显示。
[ID]是我的数据库IAM传球的主键从aspx文件到后面的code的对象,并使用该ID来从数据库中的数据。
但每次它显示同样的信息。
< ASP:超链接ID =hlnkShow=服务器的CssClass =showButton的OnClick ='&LT ;%#连接(EVAL(ID))%GT;'文本=显示工具提示=查看消息的内容> < / ASP:超链接>
在附加功能背后的code
保护字符串连接(对象对象ID)
{
回报(回归showComments($(本),+对象ID +'););
}
在JavaScript的再次ASPX
函数showComments($元素,OBJECTID)
{
$(输入[类型=隐藏] [ID $ = hfObjectID]')VAL(OBJECTID)。
}
和使用该hiddenfield值IAM作出Ajax调用,问题就解决了。
i am using a list view for viewing some information to user there i used a hyperlink in each row to show detailed information in a modal popup in the same page what i want on the click of particular hyperlink the detailed report of that row only should display. [ID] is the primary key in my database iam passing that as an object from aspx file to the code behind and using that id to fetch data from database. but each time it is showing same information.
<asp:HyperLink ID="hlnkShow" runat="server" CssClass="showButton" OnClick='<%# Attach(Eval("ID")) %>' Text="Show" ToolTip="View the contents of the message"> </asp:HyperLink>
in the code behind in the attach function
protected string Attach(object ObjectID)
{
return ("return showComments($(this),'" + ObjectID + "');");
}
in the aspx again in the javascript
function showComments($element, objectID)
{
$('input[type=hidden][id$=hfObjectID]').val(objectID);
}
and using this hiddenfield value iam making a ajax call and the problem is solved
这篇关于通过动态值在列表视图的每一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!