plz tel me how to resolve that error

my code is

<asp:GridView ID="gridView" runat="server" Style="position: relative; left: 299px; top: 69px;" PageSize="5" OnRowCommand="gridView_OnRowCommand" AllowPaging="True" OnSelectedIndexChanged="gridView_SelectedIndexChan ged1" >

<PagerTemplate>
<% if (gridView.PageIndex > 0) 
{ %>
<asp:ImageButton ID="imgBtnPrevious" runat="server" Style="vertical-align: middle;" ImageUrl="pre.jpg" OnClick="click1" 
CommandArgument="Prev" CommandName="Page" /> 

<% } %> 

<%=(gridView.PageIndex * 5) + 1%> <%=(gridView.PageIndex * 5) + gridView.Rows.Count%> 
<% if (gridView.PageIndex != (gridView.PageCount - 1)) 
{ %> 



<asp:ImageButton ID="imgBtnNext" runat="server" Style="vertical-align: middle;" ImageUrl="next.jpg" OnClick="click" CommandArgument="Next" CommandName="Page" /> 
<% } %> 

<%--<asp:ImageButton ID="imgBtnNext" runat="server"
Style="vertical-align: middle;" ImageUrl="next.jpg" 
CommandArgument='<%# Eval("Next")%>' OnClick="click" CommandName="Page" />--%>
</PagerTemplate>
</asp:GridView>
</asp:Panel>
<%--<%=(gridView.PageIndex * 5) + 1%> <%=(gridView.PageIndex * 5) + gridView.Rows.Count%> --%> 
<% if (gridView.PageIndex != (gridView.PageCount - 1)) 
{ %> 



<asp:ImageButton ID="imgBtnNext" runat="server" Style="vertical-align: middle;" ImageUrl="next.jpg" OnClick="click" CommandArgument="Next" CommandName="Page" /> 
<% } %> 

<%--<asp:ImageButton ID="imgBtnNext" runat="server"
Style="vertical-align: middle;" ImageUrl="next.jpg" 
CommandArgument='<%# Eval("Next")%>' OnClick="click" CommandName="Page" />--%>
</PagerTemplate>
</asp:GridView>

and code behind is 

public partial class _Default : System.Web.UI.Page 
{

protected void Page_Load(object sender, EventArgs e)
{


DataSet ds = new DataSet();
SqlDataAdapter adapPaging = new SqlDataAdapter("select * from customer", "Data Source=OPWFMS-7KYGZ7SB;Initial Catalog=Mayank;User ID=sa;Password=sa");
adapPaging.Fill(ds);


gridView.DataSource = ds;
gridView.DataBind();





}

public void click1(object send, ImageClickEventArgs e)
{

GridViewPageEventArgs obj = new GridViewPageEventArgs(gridView.PageIndex - 1);

gridView.PageIndex = obj.NewPageIndex;

LinkButton exmp = new LinkButton();
exmp.Text = "exmp";
Panel1.Controls.Add(exmp);

}
public void click(object send, ImageClickEventArgs e)
{

GridViewPageEventArgs obj = new GridViewPageEventArgs(gridView.PageIndex+1);

gridView.PageIndex = obj.NewPageIndex;

}


}
<%--<asp:ImageButton ID="imgBtnNext" runat="server"
Style="vertical-align: middle;" ImageUrl="next.jpg" 
CommandArgument='<%# Eval("Next")%>' OnClick="click" CommandName="Page" />--%>
</PagerTemplate>
</asp:GridView>
</asp:Panel>

In your code, I can see only closing tag ( </asp:Panel> ) of ASP.NET Panel control.

Where is the opening tag?

Also you are always using asp classic syntax in asp.net source. This will lead to complication when debugging errors.

If panel is placed inside the grid or any other control then you have to use FindControl method to have a reference of this panel object.

Panel p;
p=(Panel)GridView1.FindControl("Panel1");
...
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.