A
avital
Hi,
Can someone please help me?
I am trying to add paging to my datagrid but it isn't working. I thought that the arrows should at least appear as a link (<>) but it doesn't. it appears as <> without a link.
Thanks in advance
aspx.vb
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim isAuth As Boolean = False
Try
ad_id = CLng(Request.QueryString("ad_id"))
cat_id = Request.QueryString("cat_id")
sub_id = Request.QueryString("sub_id")
sid = Session.Item("sid")
UD = (US.GetUserDataByGuid(sid))
Catch
Response.Redirect("default.asp")
End Try
If Not UD.IsAdmin Then
isAuth = False
Response.Redirect("default.asp")
End If
AD_ApprovedState = Request.QueryString("aprst")
fillTable()
End Sub
Public Sub fillTable()
AD_ApprovedState = "1"
If AD_ApprovedState = "" Then
AD_ApprovedState = "0"
End If
cmd = oConn.CreateCommand
cmd.CommandText = "select *, 'adDetail.aspx?sid=' + @sid + '&ad_id=' + CAST(ad_id AS NVARCHAR(16))+ '&sub_id=' + CAST(sub_id AS NVARCHAR(16))+ '&cat_id=' + CAST(cat_id AS NVARCHAR(16)) AS url_str FROM ybay_mdb...ads where ad_approved=@AD_ApprovedState"
cmd.Parameters.Add("@sid", sid)
cmd.Parameters.Add("@AD_ApprovedState", AD_ApprovedState)
oConn.Open()
Dim DR As SqlDataReader
DR = cmd.ExecuteReader
DataGrid1.DataSource = DR
DataGrid1.DataBind()
DR.Close()
oConn.Close()
End Sub
Sub doPaging(ByVal s As Object, ByVal e As DataGridPageChangedEventArgs)
DataGrid1.CurrentPageIndex = e.NewPageIndex
fillTable()
DataGrid1.DataBind()
End Sub
End Class
aspx:
<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False" GridLines="Horizontal"
CellPadding="3" BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#E7E7FF"
OnPageIndexChanged="doPaging" PagerStyle-HorizontalAlign="Center" PageSize="5" AllowPaging="True"
AllowCustomPaging="True"><SelectedItemStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#738A9C"></SelectedItemStyle><AlternatingItemStyle BackColor="#F7F7F7"></AlternatingItemStyle><ItemStyle ForeColor="#4A3C8C" BackColor="#E7E7FF"></ItemStyle><HeaderStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#4A3C8C"></HeaderStyle><FooterStyle ForeColor="#4A3C8C" BackColor="#B5C7DE"></FooterStyle><Columns><asp:BoundColumn DataField="ad_poster" HeaderText="Owner"></asp:BoundColumn><asp:BoundColumn DataField="ad_expired" HeaderText="Date Expired"></asp:BoundColumn><asp:BoundColumn DataField="ad_dated" HeaderText="Date"></asp:BoundColumn><asp:BoundColumn DataField="ad_man" HeaderText="Manager"></asp:BoundColumn><asp:BoundColumn DataField="ad_quantity" HeaderText="Quantity"></asp:BoundColumn><asp:BoundColumn DataField="ad_id" HeaderText="AD_ID"></asp:BoundColumn><asp:HyperLinkColumn Text="ad_title" Target="_self" DataNavigateUrlField="url_str" DataTextField="ad_title"
HeaderText="Title"></asp:HyperLinkColumn></Columns><PagerStyle VerticalAlign="Middle" HorizontalAlign="Center" ForeColor="#4A3C8C" BackColor="#E7E7FF"></PagerStyle></asp:datagrid>
Can someone please help me?
I am trying to add paging to my datagrid but it isn't working. I thought that the arrows should at least appear as a link (<>) but it doesn't. it appears as <> without a link.
Thanks in advance
aspx.vb
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim isAuth As Boolean = False
Try
ad_id = CLng(Request.QueryString("ad_id"))
cat_id = Request.QueryString("cat_id")
sub_id = Request.QueryString("sub_id")
sid = Session.Item("sid")
UD = (US.GetUserDataByGuid(sid))
Catch
Response.Redirect("default.asp")
End Try
If Not UD.IsAdmin Then
isAuth = False
Response.Redirect("default.asp")
End If
AD_ApprovedState = Request.QueryString("aprst")
fillTable()
End Sub
Public Sub fillTable()
AD_ApprovedState = "1"
If AD_ApprovedState = "" Then
AD_ApprovedState = "0"
End If
cmd = oConn.CreateCommand
cmd.CommandText = "select *, 'adDetail.aspx?sid=' + @sid + '&ad_id=' + CAST(ad_id AS NVARCHAR(16))+ '&sub_id=' + CAST(sub_id AS NVARCHAR(16))+ '&cat_id=' + CAST(cat_id AS NVARCHAR(16)) AS url_str FROM ybay_mdb...ads where ad_approved=@AD_ApprovedState"
cmd.Parameters.Add("@sid", sid)
cmd.Parameters.Add("@AD_ApprovedState", AD_ApprovedState)
oConn.Open()
Dim DR As SqlDataReader
DR = cmd.ExecuteReader
DataGrid1.DataSource = DR
DataGrid1.DataBind()
DR.Close()
oConn.Close()
End Sub
Sub doPaging(ByVal s As Object, ByVal e As DataGridPageChangedEventArgs)
DataGrid1.CurrentPageIndex = e.NewPageIndex
fillTable()
DataGrid1.DataBind()
End Sub
End Class
aspx:
<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False" GridLines="Horizontal"
CellPadding="3" BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#E7E7FF"
OnPageIndexChanged="doPaging" PagerStyle-HorizontalAlign="Center" PageSize="5" AllowPaging="True"
AllowCustomPaging="True"><SelectedItemStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#738A9C"></SelectedItemStyle><AlternatingItemStyle BackColor="#F7F7F7"></AlternatingItemStyle><ItemStyle ForeColor="#4A3C8C" BackColor="#E7E7FF"></ItemStyle><HeaderStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#4A3C8C"></HeaderStyle><FooterStyle ForeColor="#4A3C8C" BackColor="#B5C7DE"></FooterStyle><Columns><asp:BoundColumn DataField="ad_poster" HeaderText="Owner"></asp:BoundColumn><asp:BoundColumn DataField="ad_expired" HeaderText="Date Expired"></asp:BoundColumn><asp:BoundColumn DataField="ad_dated" HeaderText="Date"></asp:BoundColumn><asp:BoundColumn DataField="ad_man" HeaderText="Manager"></asp:BoundColumn><asp:BoundColumn DataField="ad_quantity" HeaderText="Quantity"></asp:BoundColumn><asp:BoundColumn DataField="ad_id" HeaderText="AD_ID"></asp:BoundColumn><asp:HyperLinkColumn Text="ad_title" Target="_self" DataNavigateUrlField="url_str" DataTextField="ad_title"
HeaderText="Title"></asp:HyperLinkColumn></Columns><PagerStyle VerticalAlign="Middle" HorizontalAlign="Center" ForeColor="#4A3C8C" BackColor="#E7E7FF"></PagerStyle></asp:datagrid>