asp.net DataBinding - Method - From Code Behind
the below ASPX code is ok :
<asp:Label ID="lblShowInRPV1" runat="server"
Text="<%# Method() %>"></asp:Label>
is it possible to pass some parameters (from aspx code) to Method()?
in the other hand can u fix Below databinding for me ? (That Is Incorrect)
<asp:Label ID="lblShowInRPV1" runat="server"
Text="<%# Method(Eval("ID")) %>"></asp:Label>
the method in code behind is like this :
prot开发者_Go百科ected string Method(int ID)
{
string s= string.Empty;
//STUFF
return s;
}
the ID Will Be Shown In My Grid And I want To Pass It To Method()...
how can i do that?
thanks in future advance
best regards
Assuming you wanted to pass a reference to the Label
object itself, this should work:
<%# Method( lblShowInRPV1 ) %>
Otherwise, please clarify what you mean.
Or use <asp:Label ID="lblShowInRPV1" runat="server" Text='<%# Method(Eval("ID")) %>'></asp:Label>
.
精彩评论