DATAGRID DROPDOWN PROBLEM

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

    DATAGRID DROPDOWN PROBLEM


    It is in my <EditItemTempla teTag..

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

    <asp:ListItem Value="True">St okta Var</asp:ListItem>


    <asp:ListItem Value="False">S tokta Yok</asp:ListItem>


    </asp:DropDownLis t>

    In my codebehind

    Public Function SelectMyIndex(B yVal indexno As Boolean)

    ideefixesatisc = CType(Page.Find Control("CIdeef ixeSatis"),
    DropDownList)
    Response.Write( ideefixesatisc)


    End Function
    There is no problem with that code..
    However When i try to reach
    ideefixesatisc. (properties of ideefixesatisc object for example
    ideefixesatisc. DataTextField = "OK" )

    It returns
    Object reference not set to an instance of an object.
    ideefixesatisc. DataTextField = "OK"

    What can be the problem. . Any idea will be appreciated..








  • Cor Ligthert [MVP]

    #2
    Re: DATAGRID DROPDOWN PROBLEM

    Savas,

    This is at leaset the thirth time that you are asking about the same
    question, will you keep it to your original question.

    In this idea everybody is starting everytime again investigating your
    problem.

    I tested it, gave you the code, but you did not give any reply on that.

    The problem is probabably obvious. But I don't spread my answers over 10
    messages so nobody understand anymore (by instance when searching this
    newsgroup) what I am answering.


    Cor

    "Savas Ates" <in da clubschreef in bericht
    news:uqM0b%23Jr GHA.3908@TK2MSF TNGP05.phx.gbl. ..
    >
    It is in my <EditItemTempla teTag..
    >
    <asp:DropDownLi st Runat=server ID="CIdeefixeSa tis" SelectedIndex=' <%#
    SelectMyIndex(D ataBinder.Eval( Container, "DataItem.ideef ixesatis")) %>'
    >
    >>
    >
    >
    <asp:ListItem Value="True">St okta Var</asp:ListItem>
    >
    >
    <asp:ListItem Value="False">S tokta Yok</asp:ListItem>
    >
    >
    </asp:DropDownLis t>
    >
    In my codebehind
    >
    Public Function SelectMyIndex(B yVal indexno As Boolean)
    >
    ideefixesatisc = CType(Page.Find Control("CIdeef ixeSatis"),
    DropDownList)
    Response.Write( ideefixesatisc)
    >
    >
    End Function
    There is no problem with that code..
    However When i try to reach
    ideefixesatisc. (properties of ideefixesatisc object for example
    ideefixesatisc. DataTextField = "OK" )
    >
    It returns
    Object reference not set to an instance of an object.
    ideefixesatisc. DataTextField = "OK"
    >
    What can be the problem. . Any idea will be appreciated..
    >
    >
    >
    >
    >
    >
    >
    >

    Comment

    • Savas Ates

      #3
      Re: DATAGRID DROPDOWN PROBLEM

      The problem is that It cant find the control

      I changed the Page.findcontro l with Me.DataGrid1.Fi ndControl

      They both give the same error..
      ideefixesatisc = CType(Me.DataGr id1.FindControl ("CIdeefixeSati s"),
      DropDownList)



      I have that hierarchie

      <asp:DataGrid id="DataGrid1"
      <Columns>
      <EditItemTempla te>
      <asp:DropDownLi st Runat=server ID="CIdeefixeSa tis"


      How can i achieve to get my control to be finded with .Findcontrol Method.
      ?


      Error Message
      System.NullRefe renceException: Object reference not set to an instance of an
      object. at DATAGRID.WebFor m1.SelectMyInde x(Boolean indexno) in
      C:\Inetpub\wwwr oot\DOTNETDENEM E\DATAGRID\WebF orm1.aspx.vb:li ne 40


      Comment

      Working...