这个我的客户端我投入了价值Eval("UserId")并试图在服务器上获取它
<input type="button" id="Promouter" runat="server"
value='<%# Eval("UserId") %>'
onserverclick="Promoter_Onclick"> <%# Eval("FirstName") %> </input>
Run Code Online (Sandbox Code Playgroud)
这个服务器
protected void Promoter_Onclick(object sender, EventArgs e)
{
InfinityNightDataContext data = new InfinityNightDataContext();
lvInvaited.DataSource = data.PartyPpls.Where(dbPartyPpls => dbPartyPpls.PartyId == 1 && dbPartyPpls.PromoterId == sender.value);
lvInvaited.DataBind();
lvInvaited.Visible = true;
}
Run Code Online (Sandbox Code Playgroud)
我可以看到我需要的发件人的价值,但我从发件人那里得到它我知道sender.value dosn"t work如何从发件人那里得到这个值
您可能需要将其强制转换为HtmlInputButton.
protected void Promoter_Onclick(object sender, EventArgs e)
{
HtmlInputButton button = (HtmlInputButton)sender;
int value = int.Parse(button.Value.ToString()); // or int, whatever it'll be.
InfinityNightDataContext data = new InfinityNightDataContext();
lvInvaited.DataSource = data.PartyPpls.Where(dbPartyPpls => dbPartyPpls.PartyId == 1 && dbPartyPpls.PromoterId == value);
lvInvaited.DataBind();
lvInvaited.Visible = true;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
379 次 |
| 最近记录: |