Friday, December 21, 2012

NULL In GridView EVAL Calling ServerSide Method In ItemTemplate


 
Default.aspx:

<asp:GridView runat="server" ID="test">
<Columns>
<asp:TemplateField HeaderText="view">
<ItemTemplate>
<img  alt="view" onclick="window.open(slabviewlog.aspx?ID='<%#Eval("ID") %>'&name='<%#Eval("Name") %>')"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>


Default.aspx.cs:

protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("ID");
        dt.Columns.Add("Name");
        DataRow dr = dt.NewRow();
        dr["ID"] = "1";
        dr["Name"] = "sanjay";
        dt.Rows.Add(dr);


        test.DataSource = dt;
        test.DataBind();
    }



If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website