473,657 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Link button dont work in FireFox and Internet Explorer

4 New Member
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
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" MasterPageFile="~/mymAdmin/Main.Master" AutoEventWireup="true" CodeFile="inbox.aspx.cs" Inherits="inbox" Title="LoveLife :: Mymsta Inbox" %>
  2.  
  3. <asp:Content ID="Content2" ContentPlaceHolderID="cphMenu" runat="server">
  4.     <asp:Label ID="lblPageTitle" Text="Message Inbox" runat="server" ForeColor="White" Font-Bold="true" Font-Size="Small">
  5.     </asp:Label>
  6.     <hr />
  7.     <asp:Label ID="lblInboxMenu" runat="server"></asp:Label>    
  8. </asp:Content>
  9.  
  10. <asp:Content ID="Content3" ContentPlaceHolderID="cphMain" runat="server">
  11.     <table style="height: 329px">
  12.         <tr><td>
  13.             <asp:DataGrid ID="dgMessages" runat="server" Width="800px" 
  14.                 HeaderStyle-Font-Bold="true" AllowPaging="True" Height="100px" 
  15.                 HorizontalAlign="Right" >
  16.                 <AlternatingItemStyle BackColor="DarkGray" Font-Bold="False" Font-Italic="False"
  17.                     Font-Overline="False" Font-Strikeout="False" Font-Underline="False" />
  18.                 <ItemStyle HorizontalAlign="Left" />
  19.                 <HeaderStyle Font-Bold="True" ForeColor="#3399FF" HorizontalAlign="Left" />
  20.                 <PagerStyle Mode="NumericPages" HorizontalAlign="Left" Visible="False" />
  21.             </asp:DataGrid>    
  22.         </td></tr>
  23.         <tr><td style="height: 100px">
  24.              <asp:LinkButton ID="lbtnPrevious" runat="server" Text="Previous" OnClick="lbtnPrevious_Click" />
  25.              <asp:LinkButton ID="lbtnNext" runat="server" Text="Next" OnClick="lbtnNext_Click" />            
  26.              <br /><asp:Label ID="lblMsg" runat="server" ForeColor="White"></asp:Label>     
  27.         </td></tr>
  28.      </table>
  29. </asp:Content>
  30.  
Expand|Select|Wrap|Line Numbers
  1.  private int BindGrid(Int64 id, int currentPage)
  2.     {
  3.         int tp;
  4.         //UserDataSet.MessagesDataTable mt = MessageManager.GetMessagesByRecipient(id);
  5.         UserDataSet.MessagesDataTable mt = MessageManager.GetMessagesByRecipientPagedOldestFirst(id, currentPage, 10, out tp);
  6.  
  7.         int numMessages = mt.Rows.Count;
  8.  
  9.         //create a new datatable with minimal columns
  10.         DataTable dt = new DataTable("Messages");
  11.  
  12.         DataColumn dcU = new DataColumn("User");
  13.         DataColumn dcT = new DataColumn("Message title");
  14.         DataColumn dcB = new DataColumn("Message body");
  15.         DataColumn dcD = new DataColumn("Date sent");
  16.         DataColumn dcM = new DataColumn("-----");
  17.  
  18.         dt.Columns.Add(dcU);
  19.         dt.Columns.Add(dcT);
  20.         dt.Columns.Add(dcB);
  21.         dt.Columns.Add(dcD);
  22.         dt.Columns.Add(dcM);
  23.  
  24.         for (int i = 0; i < numMessages; i++)
  25.         {
  26.             if (!mt[i].isRead)
  27.             {
  28.                 UserDataSet.MessagesRow dr = (UserDataSet.MessagesRow)mt.Rows[i];
  29.                 DataRow drNew = dt.NewRow();
  30.  
  31.                 //get the name of the sender
  32.                 UserDataSet.UsersRow ur = UserManager.GetUserByUserID(System.Convert.ToInt64(mt[i].UserIDSender));
  33.                 drNew["User"] = ur.UserName;
  34.  
  35.                 Int64 uid = mt[i].UserIDSender;
  36.                 Int64 mid = mt[i].MessageID;
  37.  
  38.                 string q = "<a href='reply.aspx?msgid=" + mid.ToString() +
  39.                             "&uid=" + uid.ToString() +
  40.                             "&id=" + id.ToString() +
  41.                             "'>" +
  42.                            mt[i].MessageTitle + "</a>";
  43.                 drNew["Message title"] = q;
  44.  
  45.                 drNew["Message body"] = mt[i].MessageBody;
  46.                 drNew["Date sent"] = mt[i].SentDate;
  47.  
  48.                 string m = "<a href='inbox.aspx?msgid=" + mt[i].MessageID.ToString() +
  49.                             "'>Mark as read</a>";
  50.                 drNew["-----"] = m;
  51.  
  52.                 dt.Rows.Add(drNew);
  53.             }
  54.         }
  55.  
  56.         dgMessages.DataSource = dt;
  57.         dgMessages.DataBind();
  58.  
  59.         return tp;
  60.  
  61. private void InitialPageLoad()
  62.     {
  63.         ViewState["current_page"] = 1;
  64.         ViewState["current_record"] = 0;
  65.  
  66.         Int64 id = GetId();
  67.  
  68.         int cp = (int)ViewState["current_page"];
  69.         if (cp == 1)
  70.             lbtnPrevious.Enabled = false;        
  71.  
  72.         int totalPages = BindGrid(id, cp);
  73.  
  74.         //int numPages = (totalMessages / 4);
  75.  
  76.         if (cp == totalPages)
  77.             lbtnNext.Enabled = false;
  78.         else
  79.             lbtnNext.Enabled = true;
  80.  
  81.         lblMsg.Text = "Page " + cp + " of " + totalPages;
  82.  
  83.         //lblMsg.Text = totalMessages + " messages. Num pages: " + numPages;
  84.     }
  85.  
  86.     private void SecondaryPageLoad()
  87.     {
  88.         string ob = (string)ViewState["sort"];
  89.         string p = (string)ViewState["param"];
  90.         int cr = (int)ViewState["current_record"];
  91.         int cp = (int)ViewState["current_page"];
  92.  
  93.         if (ob == "desc")
  94.             ob = "asc";
  95.         else
  96.             ob = "desc";
  97.  
  98.         ViewState["sort"] = ob;
  99.  
  100.         if (cr == 0)
  101.             lbtnPrevious.Enabled = false;
  102.  
  103.         string uid = (string)Session["userid"];
  104.         //int i = BindGrid(uid, cr, 5, p, ob);
  105.  
  106.         //lblMsg.Text = "Page " + cp + " of " + i;
  107.     }
  108. protected void dgMessages_SortCommand(object source, DataGridSortCommandEventArgs e)
  109.     {
  110.         ViewState["param"] = e.SortExpression;
  111.  
  112.         string ob = (string)ViewState["sort"];
  113.         string p = (string)ViewState["param"];
  114.         int cr = (int)ViewState["current_record"];
  115.  
  116.         switch (p)
  117.         {
  118.             case "Ad name":
  119.                 p = "an";
  120.                 break;
  121.             case "Status":
  122.                 p = "a";
  123.                 break;
  124.             case "Times served":
  125.                 p = "ts";
  126.                 break;
  127.             case "Type":
  128.                 p = "ib";
  129.                 break;
  130.             case "Date uploaded":
  131.                 p = "du";
  132.                 break;
  133.             default:
  134.                 p = (string)ViewState["param"];
  135.                 break;
  136.         }
  137.  
  138.         ViewState["param"] = p;
  139.         string uid = (string)Session["userid"];
  140.         //int i = BindGrid(uid, cr, 5, p, ob);
  141.     }
  142. protected void lbtnNext_Click(object sender, EventArgs e)    
  143.     {
  144.         //long uid = GetId();
  145.         //int cp = (int)ViewState["current_page"];
  146.  
  147.         //lbtnPrevious.Enabled = true;
  148.  
  149.         //cp += 1;
  150.         //ViewState["current_page"] = cp;
  151.  
  152.         //int tp = BindGrid(uid, cp); //returns the total number of pages                                 
  153.  
  154.         //if (cp >= tp)
  155.         //    lbtnNext.Enabled = false;
  156.         //else
  157.         //    lbtnNext.Enabled = true;
  158.  
  159.         //if (tp == 0)
  160.         //    lblMsg.Text = "No records.";
  161.         //else
  162.         //    lblMsg.Text = "Page " + cp + " of " + tp;
  163.  
  164.         long uid = GetId();
  165.         int cp = (int)ViewState["current_page"];
  166.  
  167.         lbtnPrevious.Enabled = true;
  168.  
  169.         cp += 1;
  170.         ViewState["current_page"] = cp;
  171.  
  172.         int tp = BindGrid(uid, cp); //returns the total number of pages                                 
  173.  
  174.         if (cp >= tp)
  175.             lbtnNext.Enabled = false;
  176.         else
  177.             lbtnNext.Enabled = true;
  178.  
  179.         if (tp == 0)
  180.             lblMsg.Text = "No records.";
  181.         else
  182.             lblMsg.Text = "Page " + cp + " of " + tp;
  183.     }
  184.  
  185.     protected void lbtnPrevious_Click(object sender, EventArgs e)
  186.     {
  187.         int cp = (int)ViewState["current_page"];
  188.  
  189.         lbtnNext.Enabled = true;
  190.  
  191.         cp -= 1;
  192.         if (cp <= 1)
  193.         {
  194.             cp = 1;
  195.             lbtnPrevious.Enabled = false;
  196.         }
  197.         else
  198.             lbtnPrevious.Enabled = true;
  199.  
  200.         ViewState["current_page"] = cp;
  201.  
  202.         long uid = GetId();
  203.         int tp = BindGrid(uid, cp);
  204.  
  205.         if (tp == 0)
  206.             lblMsg.Text = "No records for this connection";
  207.         else
  208.             lblMsg.Text = "Page " + cp + " of " + tp;
  209.  
Thanks,in advance
Dec 2 '08 #1
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
Dec 2 '08 #2
XolileWarren
4 New Member
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
Dec 3 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

29
3986
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...
23
5352
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 ...
11
3426
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...
9
1988
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...
0
1377
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.
1
2320
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
1
3119
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.
2
1795
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...
6
2352
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...
0
8312
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,...
0
8827
Oralloy
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...
1
8504
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,...
0
8606
tracyyun
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...
0
7337
agi2029
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...
0
5632
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();...
0
4159
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...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1622
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.