EDITITEMTEMPLATE FINDCONTROL PROBLEM

S

Savas Ates

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(ByVal indexno As Boolean)

Dim ideefixesatisc As New DropDownList

If indexno = True Then

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

ideefixesatisc.DataTextField = "Stokta Var"

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

End If

If indexno = False Then



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

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>


///////////////
 
C

Cor Ligthert [MVP]

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.csharp,
I don't see any C# code.

Cor
 
S

Savas Ates

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top