EDITITEMTEMPLATE FINDCONTROL PROBLEM

  • Thread starter Thread starter Savas Ates
  • Start date Start date
They Are both same ... The problem is still going on...

<asp:DropDownList Runat =server ID="CIdeefixeSatis"

and

ideefixesatisc = CType(Page.FindControl("CIdeefixesatis"), DropDownList)





It is a different kind of problem



ideefixesatisc = CType(Page.FindControl("CIdeefixesatis"), DropDownList)

If indexno = True Then

ideefixesatisc.DataTextField = "Stokta Var"

ideefixesatisc.SelectedIndex =
ideefixesatisc.Items.IndexOf(ideefixesatisc.Items.FindByValue(True))

End If

If indexno = False Then

ideefixesatisc.DataTextField = "Stokta Yok"

ideefixesatisc.SelectedIndex =
ideefixesatisc.Items.IndexOf(ideefixesatisc.Items.FindByValue(False))

End If

End Function





<asp:DropDownList Runat =server ID="CIdeefixeSatis" SelectedIndex='<%#
SelectMyIndex(DataBinder.Eval(Container, "DataItem.ideefixesatis"))

%>' >


<asp:ListItem Value="True">Stokta Var</asp:ListItem>


<asp:ListItem Value="False">Stokta Yok</asp:ListItem>


</asp:DropDownList>
 
What about now ?

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

It is still same ?



Public Function SelectMyIndex(ByVal indexno As Boolean)

Dim ideefixesatisc As New DropDownList

ideefixesatisc = CType(Page.FindControl("CIdeefixeSatis"), DropDownList)



<asp:DropDownList Runat =server ID="CIdeefixeSatis" SelectedIndex='<%#
SelectMyIndex(DataBinder.Eval(Container, "DataItem.ideefixesatis")) %>' >
 
Savas,

I tried the essential part of your code and don't get any error.

Dim ideefixesatisc As DropDownList
ideefixesatisc = CType(Page.FindControl("CIdeefixeSatis"), DropDownList)
ideefixesatisc.DataTextField = "Stokta Var"

Although I don't understand what you are doing.

Cor
 
Back
Top