I know using simple jquery functions like calling something on the screen, but I have no idea how to link the code behind where the datasets, etc.
I would use this jquery:
http://www.datatables.net/
http://live.datatables.net/ # preview
But do not think any example of datatable in aspx / .Net
For example it would be this way with gridview
in aspx:
============================
<Asp: GridView ID = "GridViewTeste" runat = "server" CellPadding = "1" CellSpacing = "1"
Height = "0px" style = ";
Width = "1220px" OnRowDataBound = "GridViewTeste_RowDataBound"> <HeaderStyle BackColor="LightBlue" BorderColor="LightBlue" Height="0px" Font-Size="Smaller" BorderStyle="Solid"/> </ asp: GridView>
============================
code behind:
============================
dsTeste = ControleTeste.recuperarTeste (this.teste1.Text, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0);
Session ["dsTeste"] = dsTeste;
this.GridViewGesge.DataSource = dsTeste;
this.GridViewGesge.DataBind ();
============================
And the class of data access with mysql / odbc
============================
public static System.Data.DataSet recuperarTeste (string test1, test2 string, string test3, test4 string, string teste5, test 6 string, string teste7, teste8 string, string teste9, test10 string, string teste11, teste12 string, string test13, test14 string , teste15 string, string teste16, teste17 string, string teste18, teste19 string, string teste20, teste21 string, string teste22, teste23 string, int teste24)
{
DataSet ds = new DataSet ();
if (id == 0)
{
Odbcconex OdbcConnection = new OdbcConnection (OdbcConnectionString);
odbcconex.Open ();
string db = "select * from test1 where equipgeral =? order by (test1)";
OdbcCommand cmd = new OdbcCommand (db, odbcconex);
cmd.Parameters.Add ("test1", OdbcType.VarChar, 20). Value = test1;
OdbcDataAdapter da = new OdbcDataAdapter (cmd);
da.Fill (ds "testegeral");
odbcconex.Close ();
}
============================
...
I would like to replace the gridview connected to mysql above to use the jquery datable:
http://www.datatables.net/
?
Detail that would be the basics for me, because I would beyond all use a feature already in use griedview, which is put a checkbox in each row of griedview dynamic, and when I click on the checkbox to select the row clicked. Eg
============================
foreach (GridViewRow row in gvVisualizar.Rows)
{
CheckBox ch = (CheckBox) row.FindControl ("cbteste");
if (ch! = null)
{
if (ch.Checked)
{
cbListar.Checked = false;
ddlteste.Visible = false;
this.tbTeste1.Text row.Cells = [1]. Text;
this.lblteste1.Text row.Cells = [1]. Text;
this.tbTeste2.Text = row.Cells [2]. Text;
}
}
}
============================
How do this, with a example, because i`m not good in jquery yet, i`m learning.
Thanks in advance
I would use this jquery:
http://www.datatables.net/
http://live.datatables.net/ # preview
But do not think any example of datatable in aspx / .Net
For example it would be this way with gridview
in aspx:
============================
<Asp: GridView ID = "GridViewTeste" runat = "server" CellPadding = "1" CellSpacing = "1"
Height = "0px" style = ";
Width = "1220px" OnRowDataBound = "GridViewTeste_RowDataBound"> <HeaderStyle BackColor="LightBlue" BorderColor="LightBlue" Height="0px" Font-Size="Smaller" BorderStyle="Solid"/> </ asp: GridView>
============================
code behind:
============================
dsTeste = ControleTeste.recuperarTeste (this.teste1.Text, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0);
Session ["dsTeste"] = dsTeste;
this.GridViewGesge.DataSource = dsTeste;
this.GridViewGesge.DataBind ();
============================
And the class of data access with mysql / odbc
============================
public static System.Data.DataSet recuperarTeste (string test1, test2 string, string test3, test4 string, string teste5, test 6 string, string teste7, teste8 string, string teste9, test10 string, string teste11, teste12 string, string test13, test14 string , teste15 string, string teste16, teste17 string, string teste18, teste19 string, string teste20, teste21 string, string teste22, teste23 string, int teste24)
{
DataSet ds = new DataSet ();
if (id == 0)
{
Odbcconex OdbcConnection = new OdbcConnection (OdbcConnectionString);
odbcconex.Open ();
string db = "select * from test1 where equipgeral =? order by (test1)";
OdbcCommand cmd = new OdbcCommand (db, odbcconex);
cmd.Parameters.Add ("test1", OdbcType.VarChar, 20). Value = test1;
OdbcDataAdapter da = new OdbcDataAdapter (cmd);
da.Fill (ds "testegeral");
odbcconex.Close ();
}
============================
...
I would like to replace the gridview connected to mysql above to use the jquery datable:
http://www.datatables.net/
?
Detail that would be the basics for me, because I would beyond all use a feature already in use griedview, which is put a checkbox in each row of griedview dynamic, and when I click on the checkbox to select the row clicked. Eg
============================
foreach (GridViewRow row in gvVisualizar.Rows)
{
CheckBox ch = (CheckBox) row.FindControl ("cbteste");
if (ch! = null)
{
if (ch.Checked)
{
cbListar.Checked = false;
ddlteste.Visible = false;
this.tbTeste1.Text row.Cells = [1]. Text;
this.lblteste1.Text row.Cells = [1]. Text;
this.tbTeste2.Text = row.Cells [2]. Text;
}
}
}
============================
How do this, with a example, because i`m not good in jquery yet, i`m learning.
Thanks in advance