Click here to Skip to main content
16,008,490 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: accessing propertin parent page from user control Pin
Andreas X6-Oct-08 12:27
professionalAndreas X6-Oct-08 12:27 
QuestionHow could I protect the values of dropdownboxes after postback? Pin
JUNEYT6-Oct-08 8:13
JUNEYT6-Oct-08 8:13 
AnswerRe: How could I protect the values of dropdownboxes after postback? Pin
Vasudevan Deepak Kumar6-Oct-08 8:34
Vasudevan Deepak Kumar6-Oct-08 8:34 
GeneralRe: How could I protect the values of dropdownboxes after postback? Pin
JUNEYT6-Oct-08 8:38
JUNEYT6-Oct-08 8:38 
GeneralRe: How could I protect the values of dropdownboxes after postback? Pin
N a v a n e e t h6-Oct-08 16:10
N a v a n e e t h6-Oct-08 16:10 
AnswerRe: How could I protect the values of dropdownboxes after postback? Pin
N a v a n e e t h6-Oct-08 16:13
N a v a n e e t h6-Oct-08 16:13 
GeneralRe: How could I protect the values of dropdownboxes after postback? Pin
JUNEYT7-Oct-08 0:01
JUNEYT7-Oct-08 0:01 
QuestionPaging and sorting Pin
Sandraa6-Oct-08 8:12
Sandraa6-Oct-08 8:12 
Hi all, I have a little problem Smile | :) I have a gridview with paging and sorting, all work well except when I change the page then the gridview lost the sorting and it put again by default sorting.
Any idea how maintein the sorting when I change of page?
I send you my code, thanks for all.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            If Not Page.IsPostBack Then
                EnlazarDataGrid()
                gridView.Columns(0).SortExpression = True

            End If

        Catch ex As Exception

        End Try
End Sub
    Private Property GridViewSortDirection() As String

        Get

            Return IIf(ViewState("SortDirection") = Nothing, "ASC", ViewState("SortDirection"))

        End Get

        Set(ByVal value As String)

            ViewState("SortDirection") = value

        End Set

    End Property
    Private Property GridViewSortExpression() As String


        Get

            Return IIf(ViewState("SortExpression") = Nothing, String.Empty, ViewState("SortExpression"))

        End Get

        Set(ByVal value As String)

            ViewState("SortExpression") = value

        End Set

    End Property
    Private Function GetSortDirection() As String



        Select Case GridViewSortDirection

            Case "ASC"

                GridViewSortDirection = "DESC"



            Case "DESC"

                GridViewSortDirection = "ASC"

        End Select



        Return GridViewSortDirection

    End Function
    Protected Function SortDataTable(ByVal pdataTable As DataTable, ByVal isPageIndexChanging As Boolean) As DataView


        If Not pdataTable Is Nothing Then

            Dim pdataView As New DataView(pdataTable)


            If GridViewSortExpression <> String.Empty Then

                If isPageIndexChanging Then

                    pdataView.Sort = String.Format("{0} {1}", GridViewSortExpression, GridViewSortDirection)

                Else

                    pdataView.Sort = String.Format("{0} {1}", GridViewSortExpression, GetSortDirection())

                End If

            End If

            Return pdataView

        Else

            Return New DataView()

        End If

    End Function
    Protected Sub gridView_Sorting(ByVal sender As Object, ByVal e As GridViewSortEventArgs)
        Try
            gridView.Columns(0).Visible = True
            Dim Comunidad As Integer
            ViewState("Comunidad") = Util.Usuario.IdComunidad
            If Util.Usuario.AdminUser = 1 Then

                Comunidad = ViewState("Comunidad")
            Else
                Comunidad = Util.Usuario.IdComunidad
            End If
            Dim Propietario1 As DataTable = Propietarios.ObtenerPropietarios(Comunidad)
            gridView.DataSource = Propietario1



            GridViewSortExpression = e.SortExpression

            Dim pageIndex As Integer = gridView.PageIndex

            gridView.DataSource = SortDataTable(CType(gridView.DataSource, DataTable), False)

            gridView.DataBind()

            gridView.PageIndex = pageIndex
            gridView.Columns(0).Visible = False
        Catch ex As Exception

        End Try
    End Sub
    Protected Sub gridView_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gridView.PageIndexChanging

        Try
            gridView.Columns(0).Visible = True
            gridView.PageIndex = e.NewPageIndex
            EnlazarDataGrid()
            gridView.Columns(0).Visible = False
        Catch ex As Exception

        End Try


    End Sub

AnswerRe: Paging and sorting Pin
Andreas X6-Oct-08 12:20
professionalAndreas X6-Oct-08 12:20 
QuestionAsp.net or php Pin
Christopher Clarke6-Oct-08 6:57
Christopher Clarke6-Oct-08 6:57 
AnswerRe: Asp.net or php Pin
Vasudevan Deepak Kumar6-Oct-08 8:34
Vasudevan Deepak Kumar6-Oct-08 8:34 
QuestionHow to set SkinID of a control contained in a composite server control? Pin
Pawel Krakowiak6-Oct-08 5:47
Pawel Krakowiak6-Oct-08 5:47 
QuestionGoogle base file problem Pin
slSoftware6-Oct-08 5:21
slSoftware6-Oct-08 5:21 
Questionconverting dataview to dataset in .net2003 Pin
suresh_0016-Oct-08 5:11
suresh_0016-Oct-08 5:11 
AnswerRe: converting dataview to dataset in .net2003 Pin
thomasa6-Oct-08 5:16
thomasa6-Oct-08 5:16 
Questionis it possible that i upload mywebsite on apachi server Pin
UD(IA)6-Oct-08 4:30
UD(IA)6-Oct-08 4:30 
AnswerRe: is it possible that i upload mywebsite on apachi server Pin
eyeseetee6-Oct-08 4:33
eyeseetee6-Oct-08 4:33 
AnswerRe: is it possible that i upload mywebsite on apachi server Pin
Vasudevan Deepak Kumar6-Oct-08 8:35
Vasudevan Deepak Kumar6-Oct-08 8:35 
QuestionGood tutorial on moving items from one listbox to another Pin
eyeseetee6-Oct-08 4:24
eyeseetee6-Oct-08 4:24 
QuestionProblem with viewstate for listitems Pin
eyeseetee6-Oct-08 3:44
eyeseetee6-Oct-08 3:44 
AnswerRe: Problem with viewstate for listitems [modified] Pin
thomasa6-Oct-08 4:18
thomasa6-Oct-08 4:18 
GeneralRe: Problem with viewstate for listitems Pin
eyeseetee6-Oct-08 4:33
eyeseetee6-Oct-08 4:33 
GeneralRe: Problem with viewstate for listitems [modified] Pin
thomasa6-Oct-08 4:50
thomasa6-Oct-08 4:50 
GeneralRe: Problem with viewstate for listitems Pin
eyeseetee6-Oct-08 5:02
eyeseetee6-Oct-08 5:02 
GeneralRe: Problem with viewstate for listitems Pin
eyeseetee6-Oct-08 4:55
eyeseetee6-Oct-08 4:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.