开发者

how to send parameter from.aspx page to.cs file[in #eval method in gridview]

in my gridview item template filed i am calling an method CheckVa开发者_如何学Clue

           <asp:Label ID="Label1" runat="server" Text='<%# CheckValue(Eval("Imagespath")+","+Eval("Imagesname")%>'>
            </asp:Label>


protected string CheckValue(string strValue1,string strValue2)
    {
        if (strValue1=="1")
        {
            return "No Record Found";
        }
        else
        {
            return "No Record Found";
        }
    }

when i run my page i get errorin my .aspx page

Text='<%# CheckValue(Eval("Imagespath")+","+Eval("Imagesname")%>'>

is there any way i can send my value CheckValue method which isa .cs file how can i send 2 paremeter from.aspx page can anu one tell me the syntax for it

thank you


You are almost there... try this:

Text='<%# CheckValue(Eval("Imagespath").ToString(), Eval("Imagesname").ToString()) %>'

You don't need to add the +","+ as if you were concatenating a string (you aren't), and you do need to call ToString() on the Evals so it matches the parameter types your CheckValue method expects.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜