开发者

asp.net DataBinding - Method - From Code Behind

开发者 https://www.devze.com 2023-01-15 15:43 出处:网络
the below ASPX code is ok : <asp:Label ID=\"lblShowInRPV1\" runat=\"server\" Text=\"<%# Method() %>\"></asp:Label>

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>.

0

精彩评论

暂无评论...
验证码 换一张
取 消