how to call a function in datalist edit mode

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: how to call a function in datalist edit mode

    The "following procedure" you mentioned is structured like an Event Handler.
    Is there some reason for this? Why don't you just leave off the Event
    Handler parameters (which you don't seem to be using) and just call the Sub?

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    [url]http://www.takempis.com[/url]
    Big things are made up of
    lots of little things.

    "buran" <buran@buran.com> wrote in message
    news:OKJhjOqUDHA.2040@TK2MSFTNGP11.phx.gbl...
    > Dear ASP.NET Programmers,
    >
    > Please consider the following code:
    >
    > Private Sub dliStayDetails_ItemDataBound(ByVal sender As Object, ByVal e
    As
    > System.Web.UI.WebControls.DataListItemEventArgs) Handles
    > dliStayDetails.ItemDataBound
    >
    > If e.Item.ItemType = ListItemType.EditItem Then
    > Dim deleteButton As LinkButton
    > deleteButton = CType(e.Item.FindControl("lnkDelDischarge"),
    > LinkButton)
    > End If
    >
    > End Sub
    >
    > I would like to call function whick deletes the contents of a textbox in
    > datalist edit mode. I wrote the following procedure but I don't have an
    idea
    > how to call it.
    >
    > Sub ClearDischargeDate(ByVal sender As Object, ByVal e As
    > DataListItemEventArgs)
    > Dim txtDis As TextBox
    > txtDis = CType(e.Item.FindControl("txtDisDate"), TextBox)
    > txtDis.Text = ""
    > End Sub
    >
    > Any suggestions? Thanks in advance,
    > Buran
    >
    >

    Kevin Spencer Guest

  2. Similar Questions and Discussions

    1. Edit button not converting to edit mode
      I too had the same problem today. I've users set up as writers role to update content thru Contribute. We have two admins including my self. We...
    2. Edit button not converting to edit mode
      I think i have found the solution to this. There is a a file called ccSentPublished1.xml that is located in C:\Documents and Settings\<user...
    3. Edit button not converting to edit mode
      I am running into this issue. I am still trying to pinpoint what is causing it but am having a hard time.
    4. Would like to load a datagrid already in edit mode instead of having the user click the edit button
      Now my asp.net datagrid shows an edit button and clicking it puts the datagrid in edit mode. I would like to: 1) possilby load the page already...
    5. datalist edit mode and javascript pop up calendar
      Hi Check whether textbox control name is 'txtDischargeDate' or it contains automatically generated id? HTH Ravikanth return the selected
  3. #2

    Default Re: how to call a function in datalist edit mode

    Ok, I replaced the code with the following one as you said:

    Sub ClearDischargeDate()
    Dim txtDis As TextBox
    txtDis =
    CType(Page.FindControl("dliStayDetails").FindContr ol("txtDisDate"), TextBox)
    txtDis.Text = ""
    End Sub

    Now, how can I call this code in the event mode of the datalist control?
    Thanks for your help,

    Buran


    "Kevin Spencer" <kevin@takempis.com> wrote in message
    news:uSAXEsrUDHA.1688@TK2MSFTNGP11.phx.gbl...
    > Well, first of all, I'm still a bit confused as to why you made this as a
    > Event Handler. Do you WANT it to handle an Event from the DataList? If so,
    > just set it up to handle the event, and you're fine. Otherwise, you need
    to
    > identify the DataList, and find the control as you would any other control
    > in your Page.
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > [url]http://www.takempis.com[/url]
    > Big things are made up of
    > lots of little things.
    >
    > "buran" <buran@buran.com> wrote in message
    > news:OYRbErqUDHA.484@TK2MSFTNGP09.phx.gbl...
    > > Thanks, but how can I reference to the textbox in edit mode then?
    > >
    > > Buran
    > >
    > > "Kevin Spencer" <kevin@takempis.com> wrote in message
    > > news:#R6cenqUDHA.2368@TK2MSFTNGP09.phx.gbl...
    > > > The "following procedure" you mentioned is structured like an Event
    > > Handler.
    > > > Is there some reason for this? Why don't you just leave off the Event
    > > > Handler parameters (which you don't seem to be using) and just call
    the
    > > Sub?
    > > >
    > > > --
    > > > HTH,
    > > >
    > > > Kevin Spencer
    > > > Microsoft MVP
    > > > .Net Developer
    > > > [url]http://www.takempis.com[/url]
    > > > Big things are made up of
    > > > lots of little things.
    > > >
    > > > "buran" <buran@buran.com> wrote in message
    > > > news:OKJhjOqUDHA.2040@TK2MSFTNGP11.phx.gbl...
    > > > > Dear ASP.NET Programmers,
    > > > >
    > > > > Please consider the following code:
    > > > >
    > > > > Private Sub dliStayDetails_ItemDataBound(ByVal sender As Object,
    ByVal
    > e
    > > > As
    > > > > System.Web.UI.WebControls.DataListItemEventArgs) Handles
    > > > > dliStayDetails.ItemDataBound
    > > > >
    > > > > If e.Item.ItemType = ListItemType.EditItem Then
    > > > > Dim deleteButton As LinkButton
    > > > > deleteButton = CType(e.Item.FindControl("lnkDelDischarge"),
    > > > > LinkButton)
    > > > > End If
    > > > >
    > > > > End Sub
    > > > >
    > > > > I would like to call function whick deletes the contents of a
    textbox
    > in
    > > > > datalist edit mode. I wrote the following procedure but I don't have
    > an
    > > > idea
    > > > > how to call it.
    > > > >
    > > > > Sub ClearDischargeDate(ByVal sender As Object, ByVal e As
    > > > > DataListItemEventArgs)
    > > > > Dim txtDis As TextBox
    > > > > txtDis = CType(e.Item.FindControl("txtDisDate"), TextBox)
    > > > > txtDis.Text = ""
    > > > > End Sub
    > > > >
    > > > > Any suggestions? Thanks in advance,
    > > > > Buran
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    buran Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139