我想从数据列表中获取Id而不回发。 [英] I want to fetch Id from the datalist without postback.
本文介绍了我想从数据列表中获取Id而不回发。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用datalist我点击链接按钮它的传递ID
注意:仅在Ajax更新面板中使用
Any专家帮助.......
i am using datalist wen i click on link button its nt passing id
Note: using in only Ajax update panel
Any Expert help.......
<asp:DataList ID="DataList1" runat="server" BackColor="White"
BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3"
DataSourceID="SqlDataSource1" RepeatColumns="3" CellSpacing="1"
OnItemCommand="DataList1_ItemCommand" OnItemDataBound="DataList1_ItemDataBound" >
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
<ItemStyle BackColor="#DEDFDE" ForeColor="Black" />
<ItemTemplate>
<br />
<div class="">
<div class="pad_bot2">
<figure> <span class="act"></span><asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Image") %>' Height="230px" Width="200px" /></figure></div>
<asp:Label ID="ProjectLabel" runat="server" Text='<%# Eval("Project") %>' />
<br />
<%-- <asp:LinkButton ID="LinkButton1" CommandArgument="'<%# Eval("Id") %>' " runat="server">Detail</asp:LinkButton>
--%>
<asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("Id") %>' runat="server" >Detail</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server"
CommandArgument='<%# Eval("Id") %>' CommandName="details" CssClass="thumb" >LinkButton</asp:LinkButton>
<br />
</div>
</ItemTemplate>
<SelectedItemStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
</asp:DataList>
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
Control c = e.Item.FindControl("LinkButton2");
ScriptManager1.RegisterAsyncPostBackControl(c);
}
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
Control c = e.Item.FindControl("LinkButoon2");
ScriptManager1.RegisterAsyncPostBackControl(c);
if (e.CommandName == "details")
{
Label1.Text = e.CommandArgument.ToString();
// Session["Id"] = e.CommandArgument.ToString();
//DataList3.DataBind();
}
}
它的urjent ....
its urjent....
推荐答案
我只是浏览了你的代码,但是有一件小事突然出现,在你的第二个代码片段中,你拼错了linkButton2作为LinkButoon2(不一样)..检查出来并告诉我们。
I've only glanced over your code but one small thing glares out, in your second code snippet, you have mis-spelled "linkButton2" as "LinkButoon2" (not the same) .. check it out and let us know.
这篇关于我想从数据列表中获取Id而不回发。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文