DATAGRID DROPDOWN PROBLEM

DATAGRID DROPDOWN PROBLEM

Post by Savas Ate » Sat, 22 Jul 2006 17:28:09



It is in my <EditItemTemplate> Tag..

<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>

In my codebehind

Public Function SelectMyIndex(ByVal indexno As Boolean)

ideefixesatisc = CType(Page.FindControl("CIdeefixeSatis"),
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..
 
 
 

DATAGRID DROPDOWN PROBLEM

Post by Cor Ligthe » Sat, 22 Jul 2006 18:35:22

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 club> schreef in bericht

 
 
 

DATAGRID DROPDOWN PROBLEM

Post by Savas Ate » Sat, 22 Jul 2006 18:59:15

The problem is that It cant find the control

I changed the Page.findcontrol with Me.DataGrid1.FindControl

They both give the same error..
ideefixesatisc = CType(Me.DataGrid1.FindControl("CIdeefixeSatis"),
DropDownList)



I have that hierarchie

<asp:DataGrid id="DataGrid1"
<Columns>
<EditItemTemplate>
<asp:DropDownList Runat=server ID="CIdeefixeSatis"


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


Error Message
System.NullReferenceException: Object reference not set to an instance of an
object. at DATAGRID.WebForm1.SelectMyIndex(Boolean indexno) in
C:\Inetpub\wwwroot\DOTNETDENEME\DATAGRID\WebForm1.aspx.vb:line 40