accessing a button in datalist selected item mode

Discussion in 'ASP .Net' started by buran, Oct 13, 2003.

  1. buran

    buran Guest

    Dear ASP.NET Programmers,

    I have a datalist, which displays employee information. In selected item
    mode, the datalist displays detailed information and a button to switch to
    edit mode. What I want to accomplish is to disable the button according to
    the user (I use forms authentication). I am using the following code, but
    getting "Object reference not set to an instance of an object" error:

    Sub ItemSelected(ByVal source As Object, ByVal e As
    System.Web.UI.WebControls.DataListCommandEventArgs)
    If e.CommandName = "Selected" Then
    If Page.User.Identity.Name = "employee" Then
    Dim myButton As Button
    myButton = CType(e.Item.FindControl("btnGuncelle"), Button)
    myButton.Visible = False
    End If
    dliPersonel.SelectedIndex = e.Item.ItemIndex
    ' then bind data...
    End If
    End Sub

    Can anyone help me? Thanks in advance,

    Buran
     
    buran, Oct 13, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?cmFnZA==?=

    Datalist selected item

    =?Utf-8?B?cmFnZA==?=, Sep 25, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,645
    =?Utf-8?B?cmFnZA==?=
    Sep 25, 2004
  2. Iain
    Replies:
    3
    Views:
    968
  3. mldardy
    Replies:
    0
    Views:
    1,000
    mldardy
    Sep 28, 2010
  4. buran

    accessing a button in datalist selected item mode

    buran, Oct 13, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    150
    buran
    Oct 13, 2003
  5. Hiten
    Replies:
    1
    Views:
    701
    Vidar Petursson
    May 26, 2004
Loading...

Share This Page