This is my code :
.aspx
<asp:GridView ID="GridView_Main" ClientIDMode="Static" AutoGenerateColumns="false"
DataKeyNames="IdVersi" AllowPaging="true" AllowSorting="true" Width="97%" BorderWidth="1"
OnSelectedIndexChanged="GridView_Main_SelectedIndexChanged" OnSorted="GridView_Main_Sorted"
OnPageIndexChanged="GridView_Main_PageIndexChanged" OnPageIndexChanging="GridView_Main_PageIndexChanging"
runat="server" PageSize="4">
<EmptyDataTemplate>
<div class="EmptyDataMessage">
<asp:Label ID="Label_GridView_Empty" runat="server" Text="Data tidak ditemukan."></asp:Label>
</div>
</EmptyDataTemplate>
<HeaderStyle CssClass="GridviewHeader" />
<SelectedRowStyle CssClass="GridviewSelect" />
<AlternatingRowStyle CssClass="GridviewAlternate" />
<Columns>
<asp:TemplateField HeaderText="No Versi" ItemStyle-CssClass="GridviewItem" ItemStyle-VerticalAlign="Top"
ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="15%" ItemStyle-Wrap="false">
<ItemTemplate>
<asp:LinkButton ID="LinkButton_Select" CommandName="Select" runat="server"><%# Eval ("NoVersi") %></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Notes" HeaderText="Catatan" ItemStyle-CssClass="GridviewItem"
HeaderStyle-Width="30%" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="ModifiedOn" HeaderText="Diubah tanggal" ItemStyle-CssClass="GridviewItem"
HeaderStyle-Width="30%" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Type" HeaderText="Type" ItemStyle-CssClass="GridviewItem"
HeaderStyle-Width="30%" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Size" HeaderText="Size" ItemStyle-CssClass="GridviewItem"
HeaderStyle-Width="25%" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField HeaderText="Aksi" ItemStyle-CssClass="GridviewItem" ItemStyle-VerticalAlign="Top"
ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="20%" ItemStyle-Wrap="false">
<ItemTemplate>
<a href='<%# Eval ("UrlFile") %>'>Download</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerSettings Mode="NumericFirstLast" FirstPageImageUrl="~/App_Themes/DMS/icon/icon_nav_first_on.gif"
FirstPageText="Pertama" LastPageImageUrl="~/App_Themes/DMS/icon/icon_nav_last_on.gif"
LastPageText="Akhir" NextPageImageUrl="~/App_Themes/DMS/icon/icon_nav_next_on.gif"
PreviousPageImageUrl="~/App_Themes/DMS/icon/icon_nav_prev_on.gif" />
<PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" ForeColor="#80A0CF" />
</asp:GridView>
and .cs
protected void GridView_Main_DataBind(int NewPageIndex)
{
id_document = Convert.ToInt32(Request.QueryString[0]);
DMSDataAccess db = new DMSDataAccess();
var versi = db.DMSDataContext.Versis.Select(p => p).Where(p => p.IdDokumen == id_document);
GridView_Main.PageSize = itemPerPage;
GridView_Main.PageIndex = NewPageIndex;
GridView_Main.DataSource = versi;
GridView_Main.DataBind();
}
protected void GridView_Main_SelectedIndexChanged(object sender, EventArgs e)
{
Button_Update.Visible = false;
Button_UpdateKepemilikan.Visible = false;
Label_Modal_Title.Text = "Properties";
MultiView_Content.SetActiveView(View_Versi);
try
{
id_document = Convert.ToInt32(Request.QueryString[0]);
string id = GridView_Main.SelectedValue.ToString();
DMSDataAccess db = new DMSDataAccess();
var doc = db.DMSDataContext.Dokumens.Select(p => p).Where(p => p.IdDokumen.Equals(id_document)).FirstOrDefault();
var versi = db.DMSDataContext.Versis.Select(p => p).Where(p => p.IdVersi.Equals(id)).FirstOrDefault();
string id_category = Convert.ToString(doc.IdCategory);
Label_Value_VersiJudul.Text = doc.JudulDokumen;
Label_Value_VersiType.Text = versi.Type;
Label_Value_VersiSize.Text = Convert.ToString(versi.Size) + " Kb";
Label_Value_VersiVersi.Text = Convert.ToString(versi.NoVersi);
Label_Value_VersiAuthor.Text = GetNamaDosen(versi.UserName);
Label_Value_VersiTanggal.Text = Convert.ToString(versi.ModifiedOn);
Label_Value_VersiCategory.Text = GetNamaCategory(id_category);
Label_Value_VersiDeskripsi.Text = doc.Deskripsi;
if (versi.Notes != null)
{
Label_Value_VersiNotes.Text = versi.Notes;
}
else { Label_Value_VersiNotes.Text = "-"; }
}
catch { }
UpdatePanel_Panel_Modal.Update();
this.MPE.Show();
}
protected void GridView_Main_Sorted(object sender, EventArgs e)
{
GridView_Main_DataBind(GridView_Main.PageIndex);
GridView_Main.SelectedIndex = -1;
}
protected void GridView_Main_PageIndexChanged(object sender, EventArgs e)
{
GridView_Main_DataBind(GridView_Main.PageIndex);
GridView_Main.SelectedIndex = -1;
}
protected void GridView_Main_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView_Main.PageIndex=e.NewPageIndex;
}
what's wrong? can u help me?