473,513 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get OnPageIndexChanging in C# .NET to work with MySql

38 New Member
Hello,
I have a MySql data table that I display in a GridView in ASP .NET. The table is too large to display without paging, so I have added and OnPageIndexChanging event and corresponding handler to the GridView. But, in the GridView, when I click the next page index, the grid view disappear. See my code below.
Any help on this is very appreciated.
Best regards
Kurt Jakobsen


Expand|Select|Wrap|Line Numbers
  1. protected void g_GridCtrl_PageIndexChanging(object sender, GridViewPageEventArgs e)
  2. {
  3.   g_GridCtrl.PageIndex = e.NewPageIndex;
  4.   g_GridCtrl.DataBind();
  5. }
  6.  
  7.  
  8.  
  9. void FillInGridView()
  10. {
  11.   string myConnString = ConfigurationSettings.AppSettings["DSN_Fyrr"];
  12.   MySqlConnection myConnection = new MySqlConnection(myConnString);
  13.   string strSQL = "SELECT LocationName FROM PartLocationDef ORDER BY LocationName;" ;
  14.   MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(strSQL, myConnection);
  15.   DataSet myDataSet = new DataSet();
  16.   myDataAdapter.Fill(myDataSet, "FailTypeDef");
  17.   g_GridCtrl.DataSource = myDataSet;
  18.   g_GridCtrl.DataBind();
  19.   myConnection.Close();
  20. }
  21.  
  22.  
  23. <asp:GridView ID="g_GridCtrl" runat="server" AllowSorting="true" AllowPaging="true" DataKeyNames="LocationName" OnPageIndexChanging="g_GridCtrl_PageIndexChanging" AutoGenerateColumns="False" OnSorting="g_GridCtrl_Sorting">
  24. <Columns>
  25. <asp:BoundField ReadOnly="true" HeaderText="Location Name" DataField="LocationName" SortExpression="LocationName" />
  26. </Columns>
  27. </asp:GridView>
  28.  
Jun 26 '07 #1
1 1143
Atli
5,058 Recognized Expert Expert
This is more of a .Net problem than a MySQL problem so I'm moving it over to the .Net forums.

Moderator
Jun 26 '07 #2

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

Similar topics

5
4376
by: Adams-Blake Co. | last post by:
In table is record, field called CompanyName that has: Joe\'s Place (I added the slashes before inserting the field.) This will NOT work: $x="Joe's Place"; $sql="Select * from Company where CompanyName LIKE '%" . addslashes($x) . "%'"; (standard MySQL query code) I don't get an error, but I don't get a hit either!
8
2633
by: Wilfred Johnson | last post by:
I thought that I'd try php / mysql on windows 2000. I am running php 5.0.0 and it works fine, except when I try to use mysql functions. I get: Fatal error: Call to undefined function mysql_connect() in ... The documentation is unclear to me. It says that mysql support is now built in, but it doesn't work. Google searches say that it's not...
0
678
by: Miguel Cardenas | last post by:
Hello list For some strange reason `mysql_config --...` does not work. If try something like gcc -o progname `mysql_config --cflags` progname.c `mysql_config --libs` (NOTE: "/usr/local/mysql/bin" is in the PATH var, mysql_config works when invoked)
3
4612
by: Saqib Ali | last post by:
I have set up MySQL on my machine and can successfully use it. However, I'm trying to set up TOra so that I can browse the databases effectively. I'm having lots of trouble trying to get TOra to work with MySQL. Please take a look at the notes below and please let me know why I'm having trouble and how to fix it..... Thanks -Saqib
4
2281
by: Mark | last post by:
the Following bit of code doesn't work. It seems to respond to the second, starting with 'add iif statement for Good Practice', but not to the first, starting 'add iif statement for archived' Help me to sort this out, it has taken me almost a week to wade through and it still won't work. Select Case Forms("frmForce").OpenArgs
3
2735
by: nsh | last post by:
mailing.database.mysql, comp.lang.php subject: does "LOAD DATA" EVER work?!? I've tried EVERYTHING! version info: my isp is running my web page on a linux box with php ver. 4.4.1 according to phpinfo, the "mysql api client is ver. 4.0.25" - I have no idea how this relates, if at all, to the mysql engine's version. background:
19
8090
by: Michael | last post by:
Hi, I'm trying to do something which should be very simple - connect to the MySQL database. Here is the call, followed by the error msg. $conn = mysql_connect("localhost", "root", ""); Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/buildhw.php on line 13
15
5193
by: Kurt Jakobsen | last post by:
Hello, I have a MySql data table that I display in a GridView in ASP .NET. The table is too large to display without paging, so I have added and OnPageIndexChanging event and corresponding handler to the GridView. But, in the GridView, when I click the next page index, the grid view disappear. See my code below. Any help on this is very...
1
9550
ssnaik84
by: ssnaik84 | last post by:
Hi Guys, Last year I got a chance to work with R&D team, which was working on DB scripts conversion.. Though there is migration tool available, it converts only tables and constraints.. Rest of things (stored procedures, functions).. we have to manually edit. That time, we face some interesting challenges.. I failed to document all of them,...
0
7270
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7178
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...
0
7543
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...
0
5704
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...
1
5103
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4759
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...
0
3255
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...
0
3242
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.