Can anyone help?
I have a gridview and two link buttons;back and previous to navigate back and forward the page is working fine on Opera but the link button is not active when using FireFox and Internet explorer.The code is as follows
Any kind of help will be appreciated -
<%@ Page Language="C#" MasterPageFile="~/mymAdmin/Main.Master" AutoEventWireup="true" CodeFile="inbox.aspx.cs" Inherits="inbox" Title="LoveLife :: Mymsta Inbox" %>
-
-
<asp:Content ID="Content2" ContentPlaceHolderID="cphMenu" runat="server">
-
<asp:Label ID="lblPageTitle" Text="Message Inbox" runat="server" ForeColor="White" Font-Bold="true" Font-Size="Small">
-
</asp:Label>
-
<hr />
-
<asp:Label ID="lblInboxMenu" runat="server"></asp:Label>
-
</asp:Content>
-
-
<asp:Content ID="Content3" ContentPlaceHolderID="cphMain" runat="server">
-
<table style="height: 329px">
-
<tr><td>
-
<asp:DataGrid ID="dgMessages" runat="server" Width="800px"
-
HeaderStyle-Font-Bold="true" AllowPaging="True" Height="100px"
-
HorizontalAlign="Right" >
-
<AlternatingItemStyle BackColor="DarkGray" Font-Bold="False" Font-Italic="False"
-
Font-Overline="False" Font-Strikeout="False" Font-Underline="False" />
-
<ItemStyle HorizontalAlign="Left" />
-
<HeaderStyle Font-Bold="True" ForeColor="#3399FF" HorizontalAlign="Left" />
-
<PagerStyle Mode="NumericPages" HorizontalAlign="Left" Visible="False" />
-
</asp:DataGrid>
-
</td></tr>
-
<tr><td style="height: 100px">
-
<asp:LinkButton ID="lbtnPrevious" runat="server" Text="Previous" OnClick="lbtnPrevious_Click" />
-
<asp:LinkButton ID="lbtnNext" runat="server" Text="Next" OnClick="lbtnNext_Click" />
-
<br /><asp:Label ID="lblMsg" runat="server" ForeColor="White"></asp:Label>
-
</td></tr>
-
</table>
-
</asp:Content>
-
-
private int BindGrid(Int64 id, int currentPage)
-
{
-
int tp;
-
//UserDataSet.MessagesDataTable mt = MessageManager.GetMessagesByRecipient(id);
-
UserDataSet.MessagesDataTable mt = MessageManager.GetMessagesByRecipientPagedOldestFirst(id, currentPage, 10, out tp);
-
-
int numMessages = mt.Rows.Count;
-
-
//create a new datatable with minimal columns
-
DataTable dt = new DataTable("Messages");
-
-
DataColumn dcU = new DataColumn("User");
-
DataColumn dcT = new DataColumn("Message title");
-
DataColumn dcB = new DataColumn("Message body");
-
DataColumn dcD = new DataColumn("Date sent");
-
DataColumn dcM = new DataColumn("-----");
-
-
dt.Columns.Add(dcU);
-
dt.Columns.Add(dcT);
-
dt.Columns.Add(dcB);
-
dt.Columns.Add(dcD);
-
dt.Columns.Add(dcM);
-
-
for (int i = 0; i < numMessages; i++)
-
{
-
if (!mt[i].isRead)
-
{
-
UserDataSet.MessagesRow dr = (UserDataSet.MessagesRow)mt.Rows[i];
-
DataRow drNew = dt.NewRow();
-
-
//get the name of the sender
-
UserDataSet.UsersRow ur = UserManager.GetUserByUserID(System.Convert.ToInt64(mt[i].UserIDSender));
-
drNew["User"] = ur.UserName;
-
-
Int64 uid = mt[i].UserIDSender;
-
Int64 mid = mt[i].MessageID;
-
-
string q = "<a href='reply.aspx?msgid=" + mid.ToString() +
-
"&uid=" + uid.ToString() +
-
"&id=" + id.ToString() +
-
"'>" +
-
mt[i].MessageTitle + "</a>";
-
drNew["Message title"] = q;
-
-
drNew["Message body"] = mt[i].MessageBody;
-
drNew["Date sent"] = mt[i].SentDate;
-
-
string m = "<a href='inbox.aspx?msgid=" + mt[i].MessageID.ToString() +
-
"'>Mark as read</a>";
-
drNew["-----"] = m;
-
-
dt.Rows.Add(drNew);
-
}
-
}
-
-
dgMessages.DataSource = dt;
-
dgMessages.DataBind();
-
-
return tp;
-
-
private void InitialPageLoad()
-
{
-
ViewState["current_page"] = 1;
-
ViewState["current_record"] = 0;
-
-
Int64 id = GetId();
-
-
int cp = (int)ViewState["current_page"];
-
if (cp == 1)
-
lbtnPrevious.Enabled = false;
-
-
int totalPages = BindGrid(id, cp);
-
-
//int numPages = (totalMessages / 4);
-
-
if (cp == totalPages)
-
lbtnNext.Enabled = false;
-
else
-
lbtnNext.Enabled = true;
-
-
lblMsg.Text = "Page " + cp + " of " + totalPages;
-
-
//lblMsg.Text = totalMessages + " messages. Num pages: " + numPages;
-
}
-
-
private void SecondaryPageLoad()
-
{
-
string ob = (string)ViewState["sort"];
-
string p = (string)ViewState["param"];
-
int cr = (int)ViewState["current_record"];
-
int cp = (int)ViewState["current_page"];
-
-
if (ob == "desc")
-
ob = "asc";
-
else
-
ob = "desc";
-
-
ViewState["sort"] = ob;
-
-
if (cr == 0)
-
lbtnPrevious.Enabled = false;
-
-
string uid = (string)Session["userid"];
-
//int i = BindGrid(uid, cr, 5, p, ob);
-
-
//lblMsg.Text = "Page " + cp + " of " + i;
-
}
-
protected void dgMessages_SortCommand(object source, DataGridSortCommandEventArgs e)
-
{
-
ViewState["param"] = e.SortExpression;
-
-
string ob = (string)ViewState["sort"];
-
string p = (string)ViewState["param"];
-
int cr = (int)ViewState["current_record"];
-
-
switch (p)
-
{
-
case "Ad name":
-
p = "an";
-
break;
-
case "Status":
-
p = "a";
-
break;
-
case "Times served":
-
p = "ts";
-
break;
-
case "Type":
-
p = "ib";
-
break;
-
case "Date uploaded":
-
p = "du";
-
break;
-
default:
-
p = (string)ViewState["param"];
-
break;
-
}
-
-
ViewState["param"] = p;
-
string uid = (string)Session["userid"];
-
//int i = BindGrid(uid, cr, 5, p, ob);
-
}
-
protected void lbtnNext_Click(object sender, EventArgs e)
-
{
-
//long uid = GetId();
-
//int cp = (int)ViewState["current_page"];
-
-
//lbtnPrevious.Enabled = true;
-
-
//cp += 1;
-
//ViewState["current_page"] = cp;
-
-
//int tp = BindGrid(uid, cp); //returns the total number of pages
-
-
//if (cp >= tp)
-
// lbtnNext.Enabled = false;
-
//else
-
// lbtnNext.Enabled = true;
-
-
//if (tp == 0)
-
// lblMsg.Text = "No records.";
-
//else
-
// lblMsg.Text = "Page " + cp + " of " + tp;
-
-
long uid = GetId();
-
int cp = (int)ViewState["current_page"];
-
-
lbtnPrevious.Enabled = true;
-
-
cp += 1;
-
ViewState["current_page"] = cp;
-
-
int tp = BindGrid(uid, cp); //returns the total number of pages
-
-
if (cp >= tp)
-
lbtnNext.Enabled = false;
-
else
-
lbtnNext.Enabled = true;
-
-
if (tp == 0)
-
lblMsg.Text = "No records.";
-
else
-
lblMsg.Text = "Page " + cp + " of " + tp;
-
}
-
-
protected void lbtnPrevious_Click(object sender, EventArgs e)
-
{
-
int cp = (int)ViewState["current_page"];
-
-
lbtnNext.Enabled = true;
-
-
cp -= 1;
-
if (cp <= 1)
-
{
-
cp = 1;
-
lbtnPrevious.Enabled = false;
-
}
-
else
-
lbtnPrevious.Enabled = true;
-
-
ViewState["current_page"] = cp;
-
-
long uid = GetId();
-
int tp = BindGrid(uid, cp);
-
-
if (tp == 0)
-
lblMsg.Text = "No records for this connection";
-
else
-
lblMsg.Text = "Page " + cp + " of " + tp;
-
Thanks,in advance
2 4139 Frinavale 9,735
Recognized Expert Moderator Expert @XolileWarren
What version of Visual Studio are you using? Have you considered stepping through your code with the debugger to see what's going on? You can test in different browsers by setting the browser you want to test with as your default browser (if you're using VS 2008).
I have a feeling it has something to do with you disabling the link buttons in your Page Load event.
Have you considered simply using the paging capability built into the GridView control? This might solve all of your problems.
In the future only post code that is relevant to the problem you're facing. It makes it very hard for us to help you if we have to read through all of your code just to find a line or two that pertains to your question. Also, when posting code, please remember to use code tags.
-Frinny
I managed to find the problem, I used FireFox development tools, and when I removed all the CSS and tested the link button everything was working fine.
Thanks for your help
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Tom wilson |
last post by:
I can't believe this is such an impossibility...
I have an asp.net page. It accepts data through on form fields and
includes a submit button. The page loads up and you fill out some
stuff. The submit button posts the page back to the server. The
button code detects an entry error and sends the page back to the
user. This all works.
However, if the user presses the Back button at this point, we go back
and all the form values are...
|
by: wylbur37 |
last post by:
I'm running an Apache server on my own computer (Windows XP Pro).
I wrote a simple PHP script (called test3.php) that I'm running by
putting the following URL in the address bar of the browser (Firefox)
....
http://localhost/test3.php
The script generates the following link using the echo statement ...
|
by: minnesotti |
last post by:
Hi there,
I subscribed to a photographic pictures-hosting website which is heavy
on JavaScript. My preferred latest browser Mozilla Firefox does not
work with it -- no pictures are displayed and no buttons react to
clicking. The website's helpdesk says it should work with Firefox, and
could not offer any more advices. The JavaScript Console shows that
there are numerous errors occuring. It looks like the web browser does
not recognise...
|
by: =?Utf-8?B?Sm9obiBCYWlsZXk=?= |
last post by:
I have a ASP .Net page that allows moving around items on the page through
javascript. This page works fine in IE.
In FireFox however, I have found that if the page is using XHTML 1.0
Transitional as the doctype, you cannot set the style.left and style.top
properties of image or div tags. If you remove the doctype from the page it
works just fine, although I would rather not do this. You can work around
this by setting the cssText...
|
by: ihl81 |
last post by:
If I could assume that the user will be using MS internet explorer, could I create a link in my HTML to invoke an instance of Windows Explorer through a link? For instance, I know that each of my users will have a folder C:/Folder1 on their computer. I want to create a link on my site that will open Windows Explorer at C:/Folder1.
Could this be done so it would also work in Firefox?
Thanks in advance.
| |
by: poopsy |
last post by:
hi all, i' hav this question where i have a radio button and select one of 2 choices, whichever i select hav to display in the input box but it doesnt work
here is the code
<html>
<head>
<script language="JavaScript">
function display(){
{
frm_browser.txt_display.value=frm_broswer.txt_browser.checked.options.value
|
by: Alan F |
last post by:
Can anybody please help me with this one.
I have just changed my hosting company and moved a web site to it.
For some reason my framed menus now no longer works correctly.()
I have set up up a simple test for it at
http://www.ashbourne-town.com/test_frame.htm
The problem is that as long as I stay within my own website pages the
top menu links work fine.
|
by: TheSouthLondonSlasher |
last post by:
Thank you in advance to anyone who may be able to help. This is my
first attempt at JavaScript, so I apologize if I've done something
blatantly stupid in the below code. Basically, I have a form with 4
checkboxes, a submit button, and a cancel button. When the user
clicks submit, the page should build the URL, and submit the form, as
long as one or more boxes is checked. When the user clicks cancel,
they should be redirected back to...
|
by: freddukes |
last post by:
Okay... Goole Chrome and FireFox show my site perfect, however, IE refuses to display it perfectly...
The site I'm looking at is here and the part I'm looking at is the navigation bar and just under. In FireFox and Google chrome, there is a gap underneath each 'inactive' tab (the grey ones) and the orange tabs (or the active tabs) fade smoothly into the bar underneath. I believe most of the site has been pushed down by about 5px and I don't...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |