Click here to Skip to main content
15,901,871 members
Home / Discussions / Web Development
   

Web Development

 
Question[Message Deleted] Pin
PREMSONBABY19-Sep-06 22:41
PREMSONBABY19-Sep-06 22:41 
AnswerRe: Need javascript Pin
Guffa20-Sep-06 3:15
Guffa20-Sep-06 3:15 
AnswerRe: Need javascript Pin
Monin D.20-Sep-06 5:10
Monin D.20-Sep-06 5:10 
QuestionQuestion about calling SAPI from javascript. Pin
rryyjw19-Sep-06 22:04
rryyjw19-Sep-06 22:04 
QuestionFile upload filename Pin
DagsmanIsTheMan19-Sep-06 21:32
DagsmanIsTheMan19-Sep-06 21:32 
AnswerRe: File upload filename Pin
DagsmanIsTheMan19-Sep-06 21:36
DagsmanIsTheMan19-Sep-06 21:36 
QuestionMaintaing View State in Client Control Pin
Jesu.Official19-Sep-06 21:07
Jesu.Official19-Sep-06 21:07 
AnswerRe: Maintaing View State in Client Control Pin
Stephan Pilz20-Sep-06 21:22
Stephan Pilz20-Sep-06 21:22 
You must save and load viewstate manually. Here comes an example of an HtmlSelect. Reason for the control was, if I have many, many values in control, the viewstate is bloat. Now I save only active value in viewstate and set set users choice during postback.

Imports System.ComponentModel
Imports System.Web.UI

Namespace MyOwnWebControls

   <DefaultProperty("Text"), ToolboxData("<{0}:MyOwnHtmlSelect runat=server></{0}:MyOwnHtmlSelect>")> Public Class MyOwnHtmlSelect
      Inherits System.Web.UI.HtmlControls.HtmlSelect

      Dim m_text As String = ""

      <Bindable(True), Category("Appearance"), Description("current content"), DefaultValue("")> Property Text() As String
         Get
            Return m_text
         End Get

         Set(ByVal Value As String)
            m_text = Value
         End Set
      End Property

      Protected Overrides Function SaveViewState() As Object

         ' make an array with dimension 2
         Dim savedState(1) As Object

         Try

            ' doesn't work
            ' savedState(0) = Me.Value
            ' savedState(1) = Me.Text

            ' this works - juhu
            If Me.Items.Count > Me.SelectedIndex Then
               savedState(0) = Me.Items(Me.SelectedIndex).Value
               savedState(1) = Me.Items(Me.SelectedIndex).Text

            Else
               savedState(0) = ""
               savedState(1) = ""
            End If

         Catch err As System.Exception
            ' Do some errormessage here
         End Try

         Return savedState
      End Function

      Protected Overrides Sub LoadViewState(ByVal savedState As Object)

         Try

            If Not savedState Is Nothing Then
               ' get the old values
               Dim value As String = savedState(0)
               Dim text As String = savedState(1)

               ' get value from the site
               If Not Page.Request.Form(ID) Is Nothing Then
                  ' set new value 
                  value = Page.Request.Form(ID)
                  If value <> savedState(0) Then
                     ' if the selection changed clear the text
                     text = ""
                  End If

               Else
                  ' can be nothing - for example the pt is disabled than it is not sent back to the server
                  ' in this case we take the old value from VIEWSTATE because the user can't change the selected item
               End If

               ' set the value of the poptext to the value of the selected item
               Me.Value = value

               ' add one item with this value
               Me.Items.Add(New System.Web.UI.WebControls.ListItem(text, value))
               Me.SelectedIndex = 0
            End If

         Catch err As System.Exception
            ' Do some errormessages here
         End Try
   
      End Sub
   
   End Class
   
End Namespace


Regards
Stephan

                   \\\|///
                 \\  - -  //
                  (  @ @  )
+---------------oOOo-(_)-oOOo-----------------+
| Stephan Pilz   stephan.pilz@stephan-pilz.de |
|                <a href=www.stephan-pilz.de>www.stephan-pilz.de</a>          |
|                ICQ#: 127823481              |
+-----------------------Oooo------------------+
                 oooO   (   )
                (   )    ) /
                 \ (    (_/
                  \_)

AnswerRe: Maintaing View State in Client Control Pin
Exelioindia27-Sep-06 1:05
Exelioindia27-Sep-06 1:05 
QuestionPhp help Pin
rhys10019-Sep-06 16:43
rhys10019-Sep-06 16:43 
GeneralPersonalize your google home page [modified] Pin
Raj Lal19-Sep-06 11:45
professionalRaj Lal19-Sep-06 11:45 
GeneralRe: Personalize your google home page Pin
led mike19-Sep-06 11:54
led mike19-Sep-06 11:54 
GeneralRe: Personalize your google home page Pin
Raj Lal19-Sep-06 12:06
professionalRaj Lal19-Sep-06 12:06 
GeneralRe: Personalize your google home page Pin
Rama Krishna Vavilala19-Sep-06 12:07
Rama Krishna Vavilala19-Sep-06 12:07 
GeneralRe: Personalize your google home page Pin
led mike19-Sep-06 12:07
led mike19-Sep-06 12:07 
GeneralRe: Personalize your google home page Pin
Jon Sagara19-Sep-06 12:18
Jon Sagara19-Sep-06 12:18 
GeneralRe: Personalize your google home page Pin
Raj Lal19-Sep-06 12:42
professionalRaj Lal19-Sep-06 12:42 
GeneralRe: Personalize your google home page Pin
Jon Sagara19-Sep-06 12:54
Jon Sagara19-Sep-06 12:54 
GeneralRe: Personalize your google home page Pin
David Stone19-Sep-06 13:21
sitebuilderDavid Stone19-Sep-06 13:21 
GeneralRe: Personalize your google home page Pin
Raj Lal19-Sep-06 13:37
professionalRaj Lal19-Sep-06 13:37 
GeneralRe: Personalize your google home page Pin
David Stone19-Sep-06 13:49
sitebuilderDavid Stone19-Sep-06 13:49 
Questionwebsite blocker feature, using BHO and IWebBrowser2 Pin
daheitou19-Sep-06 5:56
daheitou19-Sep-06 5:56 
QuestionJavascript highlight words on a webpage Pin
rryyjw19-Sep-06 5:43
rryyjw19-Sep-06 5:43 
QuestionDuplicate Mails - Generated on press of Refresh button in Browser Pin
krishna1919-Sep-06 5:20
krishna1919-Sep-06 5:20 
AnswerRe: Duplicate Mails - Generated on press of Refresh button in Browser Pin
Paddy Boyd19-Sep-06 5:27
Paddy Boyd19-Sep-06 5:27 

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.