Trouver un fichier de code source :
   

Version Française - English Version
Accueil > 

ASP

 > 

GRIDVIEW WITH TREEVIEW AND CALLBACK

 > 

WindowsControlLibrary1/WebApplication2/GridTreeView.aspx.cs


GRIDVIEW WITH TREEVIEW AND CALLBACK

WindowsControlLibrary1/WebApplication2/GridTreeView.aspx.cs


Informations sur ce code source

Cliquez pour voir la capture en taille normale
Code Source GRIDVIEW WITH TREEVIEW AND CALLBACK
Auteur fredzool
Fichier WindowsControlLibrary1/WebApplication2/GridTreeView.aspx.cs en ASP / ASP.NET
Publié le 01/05/2010
Mis à jour le 01/05/2010

Voici un gridview qui contient un tree view pour plier et deplier les lignes il faut que dans la source de donnee il y ai un colonne expandable, qui definit que cette ligne a des enfants il faut egalement un colonne level qui definit le niveau hi
 

Fichier : WindowsControlLibrary1/WebApplication2/GridTreeView.aspx.cs

Nombre de lignes : 112 lignes


Afficher ce fichier en plein écran
  • using System;
  • using System.Collections.Generic;
  • using System.Linq;
  • using System.Web;
  • using System.Web.UI;
  • using System.Web.UI.WebControls;
  • using WebApplication2.Datas;
  • using WebControlLibrary1;
  • using System.Text;
  • namespace WebApplication2
  • {
  • public partial class GridTreeView : System.Web.UI.Page, ICallbackEventHandler
  • {
  • private const string connectionString = @"Data Source=FREDZOOL\SQLEXPRESS;Initial Catalog=DB2008;Integrated Security=True";
  • private string result = "mon resultat";
  • private readonly int LEVEL_COLUMN_INDEX = 3;
  • private readonly int EXPANDABLE_COLUMN_INDEX = 4;
  • protected void Page_Load(object sender, EventArgs e)
  • {
  • if (!IsPostBack)
  • {
  • MyDatasDataContext context = new MyDatasDataContext();
  • var datas = from d in context.Organizations
  • select d;
  • GridView1.DataSource = datas;
  • GridView1.DataBind();
  • }
  • }
  • protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  • {
  • TreeViewButton img = e.Row.FindControl("TreeViewButton1") as TreeViewButton;
  • Label monLabel = e.Row.FindControl("monLabel") as Label;
  • //on definit les index des colonnes level et expandable que l'on va masquer
  • e.Row.Cells[LEVEL_COLUMN_INDEX].Style["visibility"] = "hidden";
  • e.Row.Cells[EXPANDABLE_COLUMN_INDEX].Style["visibility"] = "hidden";
  • if (img != null)
  • {
  • Organization d = e.Row.DataItem as Organization;
  • img.RowIndex = e.Row.RowIndex;
  • img.DestinationControl = ((GridView)sender).ClientID;
  • //niveau 0 on ne met pas d'image
  • if (d.Level == 0)
  • {
  • img.ImageUrl = "";
  • img.Style["visibility"] = "hidden";
  • return;
  • }
  • img.Style["margin-left"] = string.Format("{0}px", (d.Level * 20));
  • //niveau 1 on met un plus
  • if (d.Level == 1)
  • {
  • img.ImageUrl = img.PlusImg;
  • return;
  • }
  • //on cache les autres lignes
  • img.Style["visibility"] = "hidden";
  • img.Style["display"] = "none";
  • //les lignes superieurs dont le level est superieur à 0
  • //et n'est pas expandable on met l'image railroad
  • if (d.Level > 1)
  • {
  • if (d.Expandable == false)
  • img.ImageUrl = img.RailroadImg;
  • e.Row.Style["display"] = "none";
  • img.Style["margin-left"] = string.Format("{0}px", (d.Level * 20));
  • }
  • }
  • }
  • #region ICallbackEventHandler Members
  • public string GetCallbackResult()
  • {
  • return result;
  • }
  • public void RaiseCallbackEvent(string eventArgument)
  • {
  • result = eventArgument; ;
  • }
  • #endregion
  • protected void GridView1_Disposed(object sender, EventArgs e)
  • {
  • }
  • protected void GridView1_DataBound(object sender, EventArgs e)
  • {
  • GridView1.HeaderRow.Cells[LEVEL_COLUMN_INDEX].Style["visibility"] = "hidden";
  • GridView1.HeaderRow.Cells[EXPANDABLE_COLUMN_INDEX].Style["visibility"] = "hidden";
  • //GridView1.Columns[EXPANDABLE_COLUMN_INDEX].Style["visibility"] = "hidden";
  • }
  • }
  • }


Liste des fichiers du ZIP

FichierTaille
WindowsControlLibrary1/UpgradeLog.XML7,96 Ko
WindowsControlLibrary1/Web.config7,66 Ko
WindowsControlLibrary1/WebApplication2/Datas/CreationScript.sql3,74 Ko
WindowsControlLibrary1/WebApplication2/Datas/MyDatas.dbml1,36 Ko
WindowsControlLibrary1/WebApplication2/Datas/MyDatas.dbml.layout1,27 Ko
WindowsControlLibrary1/WebApplication2/Datas/MyDatas.designer.cs7,84 Ko
WindowsControlLibrary1/WebApplication2/Datas/myDatas.xml1,37 Ko
WindowsControlLibrary1/WebApplication2/Default.aspx3,25 Ko
WindowsControlLibrary1/WebApplication2/Default.aspx.cs2,72 Ko
WindowsControlLibrary1/WebApplication2/Default.aspx.designer.cs6,39 Ko
WindowsControlLibrary1/WebApplication2/GridTreeView.aspx2,05 Ko
WindowsControlLibrary1/WebApplication2/GridTreeView.aspx.cs3,65 Ko
WindowsControlLibrary1/WebApplication2/GridTreeView.aspx.designer.cs1,45 Ko
WindowsControlLibrary1/WebApplication2/Images/Blue.gif1,15 Ko
WindowsControlLibrary1/WebApplication2/Images/minus.gif856 o
WindowsControlLibrary1/WebApplication2/Images/plus.gif868 o
WindowsControlLibrary1/WebApplication2/Images/railroad.gif843 o
WindowsControlLibrary1/WebApplication2/Images/Thumbs.db6,5 Ko
WindowsControlLibrary1/WebApplication2/MyCallbackTests.aspx2,24 Ko
WindowsControlLibrary1/WebApplication2/MyCallbackTests.aspx.cs2,79 Ko
WindowsControlLibrary1/WebApplication2/MyCallbackTests.aspx.designer.cs2,42 Ko
WindowsControlLibrary1/WebApplication2/PourOdile.aspx1,21 Ko
WindowsControlLibrary1/WebApplication2/PourOdile.aspx.cs1,39 Ko
WindowsControlLibrary1/WebApplication2/PourOdile.aspx.designer.cs1,81 Ko
WindowsControlLibrary1/WebApplication2/Properties/AssemblyInfo.cs1,5 Ko
WindowsControlLibrary1/WebApplication2/Properties/Resources.Designer.cs2,79 Ko
WindowsControlLibrary1/WebApplication2/Properties/Resources.resx4,32 Ko
WindowsControlLibrary1/WebApplication2/Web.config7,54 Ko
WindowsControlLibrary1/WebApplication2/WebApplication2.csproj7,99 Ko
WindowsControlLibrary1/WebApplication2/WebApplication2.csproj.user1,26 Ko
WindowsControlLibrary1/WebApplication2/WebForm1.aspx1,65 Ko
WindowsControlLibrary1/WebApplication2/WebForm1.aspx.cs767 o
WindowsControlLibrary1/WebApplication2/WebForm1.aspx.designer.cs3,11 Ko
WindowsControlLibrary1/WebApplication2/WebForm2.aspx3,84 Ko
WindowsControlLibrary1/WebApplication2/WebForm2.aspx.cs3,22 Ko
WindowsControlLibrary1/WebApplication2/WebForm2.aspx.designer.cs3,4 Ko
WindowsControlLibrary1/WebControlLibrary1/cal/calendar.gif1,17 Ko
WindowsControlLibrary1/WebControlLibrary1/cal/close.gif106 o
WindowsControlLibrary1/WebControlLibrary1/cal/divider.gif49 o
WindowsControlLibrary1/WebControlLibrary1/cal/drop1.gif856 o
WindowsControlLibrary1/WebControlLibrary1/cal/drop2.gif877 o
WindowsControlLibrary1/WebControlLibrary1/cal/left1.gif850 o
WindowsControlLibrary1/WebControlLibrary1/cal/left2.gif864 o
WindowsControlLibrary1/WebControlLibrary1/cal/popcalendar.css3,18 Ko
WindowsControlLibrary1/WebControlLibrary1/cal/popcalendar.js23,13 Ko
WindowsControlLibrary1/WebControlLibrary1/cal/right1.gif851 o
WindowsControlLibrary1/WebControlLibrary1/cal/right2.gif862 o
WindowsControlLibrary1/WebControlLibrary1/cal/up2.gif112 o
WindowsControlLibrary1/WebControlLibrary1/cal/vssver.scc240 o
WindowsControlLibrary1/WebControlLibrary1/CallBackButton.cs3,63 Ko
WindowsControlLibrary1/WebControlLibrary1/CustomButton.cs2,2 Ko
WindowsControlLibrary1/WebControlLibrary1/CustomDatePicker.cs10,03 Ko
WindowsControlLibrary1/WebControlLibrary1/CustomImageButton.cs1,75 Ko
WindowsControlLibrary1/WebControlLibrary1/DatePickerTextBox.cs4,79 Ko
WindowsControlLibrary1/WebControlLibrary1/Images/minus.gif856 o
WindowsControlLibrary1/WebControlLibrary1/Images/plus.gif868 o
WindowsControlLibrary1/WebControlLibrary1/Javascripts/CallBackScripts.js255 o
WindowsControlLibrary1/WebControlLibrary1/Javascripts/IsNumeric.js1,31 Ko
WindowsControlLibrary1/WebControlLibrary1/Javascripts/Money.js1,41 Ko
WindowsControlLibrary1/WebControlLibrary1/Javascripts/TreeViewButton.js2,72 Ko
WindowsControlLibrary1/WebControlLibrary1/MoneyTextBox.cs5,11 Ko
WindowsControlLibrary1/WebControlLibrary1/MoneyTextBoxWithoutJs.cs4,22 Ko
WindowsControlLibrary1/WebControlLibrary1/NumericTextBox.cs4,62 Ko
WindowsControlLibrary1/WebControlLibrary1/Properties/AssemblyInfo.cs3,06 Ko
WindowsControlLibrary1/WebControlLibrary1/TreeViewButton.cs6,38 Ko
WindowsControlLibrary1/WebControlLibrary1/WebControlLibrary1.csproj5,32 Ko
WindowsControlLibrary1/WebControlLibrary1/WebControlLibrary1.csproj.user486 o
WindowsControlLibrary1/WindowsControlLibrary1.sln2,59 Ko
WindowsControlLibrary1/WindowsControlLibrary1.suo71,5 Ko

Pour télécharger le zip au complet, veuillez vous rendre sur cette page :
Télécharger GRIDVIEW WITH TREEVIEW AND CALLBACK


Sources du même auteur ayant un ZIP


Voir la suite...


Sources du même langage comportant un zip


Voir la suite...





Logiciels à télécharger...

  • Easy-Planning (4.5.0.11)
    Easy-Planning (4.5.0.11)
    Easy-Planning permet de créer des plannings sous la représentation de diagrammes et est adapté aux petites et moyennes entreprises(PME). Easy-Planning permet la création de plannings prévisionnels, p...
  • CVEasy (3.1.0.51)
    CVEasy (3.1.0.51)
    PHMSD-CVEasy est un logiciel d'aide à la rédaction de CV d'une simplicité déconcertante. PHMSD-CVEasy vous assistera pour la rédaction de votre CV, le CV de vos amis ou de membres de votre famille, m...
  • LettresFaciles 2011 (8.6.0.31)
    LettresFaciles 2011 (8.6.0.31)
    LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types. Son interface simple d'utilisation mais suffisamment complète vous permettra de créer une multitude de lettres....

Sondage...

Le top des photos

Photo ??Photo ???????????????
Photo ????????Photo ????????
 

Développement réalisé par Nicolas SOREL (Nix) et Emmanuel (EBArtSoft) avec l'aide de Cyril DURAND, Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,48 sec