EDITITEMTEMPLATE FINDCONTROL PROBLEM

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Savas Ates

    #1

    EDITITEMTEMPLATE FINDCONTROL PROBLEM

    My aim is showing product availability in a dropdown by checking the
    database issues and let user to change its value...

    The Error :
    ideefixesatisc. DataTextField = "Stokta Yok"
    Object reference not set to an instance of an object.


    In my edit item template i have a dropdown like that

    //////////////////////////////

    My function

    Public Function SelectMyIndex(B yVal indexno As Boolean)

    Dim ideefixesatisc As New DropDownList

    If indexno = True Then

    ideefixesatisc = CType(Page.Find Control("CIdeef ixesatis"), DropDownList)

    ideefixesatisc. DataTextField = "Stokta Var"

    ideefixesatisc. SelectedIndex =
    ideefixesatisc. Items.IndexOf(i deefixesatisc.I tems.FindByValu e(True))

    End If

    If indexno = False Then



    ideefixesatisc = CType(Page.Find Control("CIdeef ixesatis"), DropDownList)

    ideefixesatisc. DataTextField = "Stokta Yok"

    ideefixesatisc. SelectedIndex =
    ideefixesatisc. Items.IndexOf(i deefixesatisc.I tems.FindByValu e(False))



    End If

    End Function



    <asp:DropDownLi st Runat =server ID="CIdeefixeSa tis" SelectedIndex=' <%#
    SelectMyIndex(D ataBinder.Eval( Container, "DataItem.ideef ixesatis")) %>' >

    <asp:ListItem Value ="True" >Stokta Var</asp:ListItem>
    <asp:ListItem Value ="False" >Stokta Yok</asp:ListItem>
    </asp:DropDownLis t>


    ///////////////


  • Cor Ligthert [MVP]

    #2
    Re: EDITITEMTEMPLAT E FINDCONTROL PROBLEM

    Savas,

    Did you try it with the same cases for "CIdeefixeSatis ". Identifiers as
    strings are not a real part of the VBNet code and therefore (mostly) case
    sensetive,

    By the way, why did you sent this message to the newsgroup languages.cshar p,
    I don't see any C# code.

    Cor

    "Savas Ates" <in da clubschreef in bericht
    news:erleHo9qGH A.1552@TK2MSFTN GP02.phx.gbl...
    My aim is showing product availability in a dropdown by checking the
    database issues and let user to change its value...
    >
    The Error :
    ideefixesatisc. DataTextField = "Stokta Yok"
    Object reference not set to an instance of an object.
    >
    >
    In my edit item template i have a dropdown like that
    >
    //////////////////////////////
    >
    My function
    >
    Public Function SelectMyIndex(B yVal indexno As Boolean)
    >
    Dim ideefixesatisc As New DropDownList
    >
    If indexno = True Then
    >
    ideefixesatisc = CType(Page.Find Control("CIdeef ixesatis"), DropDownList)
    >
    ideefixesatisc. DataTextField = "Stokta Var"
    >
    ideefixesatisc. SelectedIndex =
    ideefixesatisc. Items.IndexOf(i deefixesatisc.I tems.FindByValu e(True))
    >
    End If
    >
    If indexno = False Then
    >
    >
    >
    ideefixesatisc = CType(Page.Find Control("CIdeef ixesatis"), DropDownList)
    >
    ideefixesatisc. DataTextField = "Stokta Yok"
    >
    ideefixesatisc. SelectedIndex =
    ideefixesatisc. Items.IndexOf(i deefixesatisc.I tems.FindByValu e(False))
    >
    >
    >
    End If
    >
    End Function
    >
    >
    >
    <asp:DropDownLi st Runat =server ID="CIdeefixeSa tis" SelectedIndex=' <%#
    SelectMyIndex(D ataBinder.Eval( Container, "DataItem.ideef ixesatis")) %>' >
    >
    <asp:ListItem Value ="True" >Stokta Var</asp:ListItem>
    <asp:ListItem Value ="False" >Stokta Yok</asp:ListItem>
    </asp:DropDownLis t>
    >
    >
    ///////////////
    >

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: EDITITEMTEMPLAT E FINDCONTROL PROBLEM

      Savas,

      You use Uper and Lower cases in that identifier mixed up.

      Cor

      "Savas Ates" <in da clubschreef in bericht
      news:uy8pq49qGH A.4336@TK2MSFTN GP02.phx.gbl...
      >I didnt understand what you meant ? What you meant by saying
      >"CIdeefixeSati s" case ? How can i solve that problem ?
      >
      >
      "Cor Ligthert [MVP]" <notmyfirstname @planet.nl>, haber iletisinde þunlarý
      yazdý:u2HCxt9qG HA.4424@TK2MSFT NGP05.phx.gbl.. .
      >Savas,
      >>
      >Did you try it with the same cases for "CIdeefixeSatis ". Identifiers as
      >strings are not a real part of the VBNet code and therefore (mostly) case
      >sensetive,
      >>
      >By the way, why did you sent this message to the newsgroup
      >languages.csha rp, I don't see any C# code.
      >>
      >Cor
      >>
      >"Savas Ates" <in da clubschreef in bericht
      >news:erleHo9qG HA.1552@TK2MSFT NGP02.phx.gbl.. .
      >>My aim is showing product availability in a dropdown by checking the
      >>database issues and let user to change its value...
      >>>
      >>The Error :
      >>ideefixesatis c.DataTextField = "Stokta Yok"
      >>Object reference not set to an instance of an object.
      >>>
      >>>
      >>In my edit item template i have a dropdown like that
      >>>
      >>//////////////////////////////
      >>>
      >>My function
      >>>
      >>Public Function SelectMyIndex(B yVal indexno As Boolean)
      >>>
      >>Dim ideefixesatisc As New DropDownList
      >>>
      >>If indexno = True Then
      >>>
      >>ideefixesatis c = CType(Page.Find Control("CIdeef ixesatis"), DropDownList)
      >>>
      >>ideefixesatis c.DataTextField = "Stokta Var"
      >>>
      >>ideefixesatis c.SelectedIndex =
      >>ideefixesatis c.Items.IndexOf (ideefixesatisc .Items.FindByVa lue(True))
      >>>
      >>End If
      >>>
      >>If indexno = False Then
      >>>
      >>>
      >>>
      >>ideefixesatis c = CType(Page.Find Control("CIdeef ixesatis"), DropDownList)
      >>>
      >>ideefixesatis c.DataTextField = "Stokta Yok"
      >>>
      >>ideefixesatis c.SelectedIndex =
      >>ideefixesatis c.Items.IndexOf (ideefixesatisc .Items.FindByVa lue(False))
      >>>
      >>>
      >>>
      >>End If
      >>>
      >>End Function
      >>>
      >>>
      >>>
      >><asp:DropDown List Runat =server ID="CIdeefixeSa tis" SelectedIndex=' <%#
      >>SelectMyIndex (DataBinder.Eva l(Container, "DataItem.ideef ixesatis")) %>'
      >> >
      >>>
      >> <asp:ListItem Value ="True" >Stokta Var</asp:ListItem>
      >> <asp:ListItem Value ="False" >Stokta Yok</asp:ListItem>
      >></asp:DropDownLis t>
      >>>
      >>>
      >>///////////////
      >>>
      >>
      >>
      >
      >

      Comment

      • Savas Ates

        #4
        Re: EDITITEMTEMPLAT E FINDCONTROL PROBLEM

        I didnt understand what you meant ? What you meant by saying
        "CIdeefixeSatis " case ? How can i solve that problem ?


        "Cor Ligthert [MVP]" <notmyfirstname @planet.nl>, haber iletisinde þunlarý
        yazdý:u2HCxt9qG HA.4424@TK2MSFT NGP05.phx.gbl.. .
        Savas,
        >
        Did you try it with the same cases for "CIdeefixeSatis ". Identifiers as
        strings are not a real part of the VBNet code and therefore (mostly) case
        sensetive,
        >
        By the way, why did you sent this message to the newsgroup
        languages.cshar p, I don't see any C# code.
        >
        Cor
        >
        "Savas Ates" <in da clubschreef in bericht
        news:erleHo9qGH A.1552@TK2MSFTN GP02.phx.gbl...
        >My aim is showing product availability in a dropdown by checking the
        >database issues and let user to change its value...
        >>
        >The Error :
        >ideefixesatisc .DataTextField = "Stokta Yok"
        >Object reference not set to an instance of an object.
        >>
        >>
        >In my edit item template i have a dropdown like that
        >>
        >//////////////////////////////
        >>
        >My function
        >>
        >Public Function SelectMyIndex(B yVal indexno As Boolean)
        >>
        >Dim ideefixesatisc As New DropDownList
        >>
        >If indexno = True Then
        >>
        >ideefixesati sc = CType(Page.Find Control("CIdeef ixesatis"), DropDownList)
        >>
        >ideefixesatisc .DataTextField = "Stokta Var"
        >>
        >ideefixesatisc .SelectedIndex =
        >ideefixesatisc .Items.IndexOf( ideefixesatisc. Items.FindByVal ue(True))
        >>
        >End If
        >>
        >If indexno = False Then
        >>
        >>
        >>
        >ideefixesati sc = CType(Page.Find Control("CIdeef ixesatis"), DropDownList)
        >>
        >ideefixesatisc .DataTextField = "Stokta Yok"
        >>
        >ideefixesatisc .SelectedIndex =
        >ideefixesatisc .Items.IndexOf( ideefixesatisc. Items.FindByVal ue(False))
        >>
        >>
        >>
        >End If
        >>
        >End Function
        >>
        >>
        >>
        ><asp:DropDownL ist Runat =server ID="CIdeefixeSa tis" SelectedIndex=' <%#
        >SelectMyIndex( DataBinder.Eval (Container, "DataItem.ideef ixesatis")) %>' >
        >>
        > <asp:ListItem Value ="True" >Stokta Var</asp:ListItem>
        > <asp:ListItem Value ="False" >Stokta Yok</asp:ListItem>
        ></asp:DropDownLis t>
        >>
        >>
        >///////////////
        >>
        >
        >

        Comment

        Working...