Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Paginazione DataGrid: oltre ai numeri si può scrivere altro?

    Ciao a tutti!
    Ho un problema con il DataGrid: ho utilizzato le sue proprietà di paginazione di default, più precisamente la PagerStyle-Mode="NumericPages" e tutto funziona perfettamente.
    Il problema è che vorrei mettere oltre ai numeri anche una scritta del tipo "Pagine" davanti ad essi, cioè vorrei che sotto alla mia DataGrid ci fosse scritto "Pag. 1 2 3 4" anziche "1 2 3 4".
    Come posso fare?
    Ciao e GRAZIE DI ESISTERE! Marcotx
    Pesce che lotta contro la corrente muore fulminato
    http://www.arda.freeweb.net/ard.jpg

  2. #2
    Utente di HTML.it L'avatar di Legnetto
    Registrato dal
    May 2002
    Messaggi
    1,419
    Da aggiungere nel foglio di stile:
    .PagerSpan {FONT-WEIGHT: bold; COLOR: blue}
    .PagerLink {BEHAVIOR: url(MouseOver.htc)}

    Metti nel file.aspx all'interno del datagrid:
    OnItemCreated="Grid_NewItem"

    poi nel file.vb oppure dove metti il codice.vb
    Sub Grid_NewItem(objSender As Object, objArgs As DataGridItemEventArgs)
    Dim itemType as ListItemType = objArgs.Item.ItemType
    if itemType = ListItemType.Pager then
    Dim pager as TableCell = CType(objArgs.Item.Controls(0), TableCell)
    Dim l As Label, h As LinkButton, i As Integer
    for i=0 to pager.Controls.Count Step 2
    try:
    l = CType(pager.Controls(i), Label)
    l.text = "Pagina. " + l.text
    l.CssClass = "PagerSpan"
    Catch:
    h = CType(pager.Controls(i), LinkButton)
    h.Text = "[ " + h.text + " ]"
    h.CssClass = "PagerLink"
    end Try
    next
    end if
    End Sub

    E questo è il file da mettere nella cartella principale che salvi come:
    MouseOver.HTC

    <PUBLIC:HTC>
    <PUBLIC:PROPERTY name="ForeColor" />
    <PUBLIC:PROPERTY name="BackColor" />

    <PUBLIC:ATTACH event="oncontentready" handler="fnInit"/>
    <PUBLIC:ATTACH event="onmouseover" handler="fnOver"/>
    <PUBLIC:ATTACH event="onmouseout" handler="fnOut"/>

    <SCRIPT language="jscript">

    var g_curColor = "";
    var g_curBgColor = "";


    function fnInit() {
    if (ForeColor == null)
    ForeColor = "red";
    if (BackColor == null)
    BackColor = element.style.backgroundColor;

    var strComponentURL = this.document.URL;
    var nPos = strComponentURL.lastIndexOf("?");
    if (nPos != -1)
    {
    var s = strComponentURL.substring(nPos+1);
    eval(s);
    }

    }


    function fnOver() {
    g_curBgColor = element.style.backgroundColor;
    g_curColor = element.style.color;

    element.style.color = ForeColor;
    element.style.backgroundColor = BackColor;
    element.style.cursor = "hand";
    }



    function fnOut() {
    element.style.color = g_curColor;
    element.style.backgroundColor = g_curBgColor;
    element.style.cursor = "";
    }

    </SCRIPT>

    </PUBLIC:HTC>


    Ciao
    Legnetto

  3. #3
    Con questo inserisci immagini:

    <SCRIPT RUNAT="SERVER">
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    'al load della pagina imposto le proprietà prevpagetext e nextpagetext

    ' immagine e testo
    datagrid1.PagerStyle.PrevPageText = "[img]freccia_sx.gif[/img]precedenti"

    'testo e immagine
    datagrid1.PagerStyle.NextPageText = "successivi[img]freccia_dx.gif[/img]"

    'resto routine

    End Sub
    </SCRIPT>

  4. #4
    Grazie mille ad entrambi!
    Ora vado a provare i codici...
    Ciao e GRAZIE DI ESISTERE! Marcotx
    Pesce che lotta contro la corrente muore fulminato
    http://www.arda.freeweb.net/ard.jpg

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.