I have WebDropDown control that shows images and text. Works fine if AutoPosttBack=false. If I enabled Postback and select item I got System.NullReferenceException error on <img source line in ASPX.
Here is my code:
<ig:WebDropDown ID="WebDropDown1" runat="server" Width="200px" DataSourceID="ObjectDataSource1" TextField="groupname" ValueField="groupid" CurrentValue="Add Permission To Group/User" AutoPostBack="True" > <DropDownItemBinding TextField="groupname" ValueField="groupid"></DropDownItemBinding> <ItemTemplate> <img src='<%# Eval("id").ToString()=="1" ? "../images/group.png" : "../images/user.png" %>' alt="" width="16" height="16" /> <%# DataBinder.Eval(Container.DataItem, "groupname")%> </ItemTemplate> </ig:WebDropDown>
Hello Al,
Please take a look at the attached sample created via NetAdvantage 11.2.20112.1019 and tested under IE9. The sample does not provide the misbehavior you are facing. Please modify it or create a new one reproducing the issue in order to be able to provide any help. Please also specify if your build of NetAdvantage is different or if you are using different browser.
I cannot use your sample because I don't have your version of dll's. I am using Infragistics35.Web.v10.2, Version=10.2.20102.1011 and IE8.
Thanks
HelloPlease take a look at the modified sample wich uses your version of NA. We highly recommend upgrading to latest servise release of your version.
can you just help me through?I am using three webdropdowns, on selecting value from 1st the items of 2nd changes, and similarly of 3rd.now the problem is if i get back to the 1st and change the selection, the next dropdown does get changed values accordingly but the textbox(of the webdropdown, where the selection is seen) does not get refreshed, it still holds the value from the last selection.thanks in advance..
Hello arkgroup,
Let me know if you have further questions.
When a Postback is executed the data in the dropdown should be refreshed and if the needed data is not present (since you bin the control only on initial load the Data Source is not assigned after Postback) the mentioned exception will occur.
You can provide the data for the dropdown on every Postback, use the workaround provided by Nikifor or this one:
<ItemTemplate> <img src='<%# DataBinder.Eval(Container.DataItem, "groupid")%>' width="48" height="48" alt="" /> <%# DataBinder.Eval(Container.DataItem, "groupname")%> </ItemTemplate>
<ItemTemplate>
<img src='<%# DataBinder.Eval(Container.DataItem, "groupid")%>' width="48" height="48" alt="" />
<%# DataBinder.Eval(Container.DataItem, "groupname")%>
</ItemTemplate>
You can also look at the following sample - http://samples.infragistics.com/aspnet/Samples/WebDropDown/Display/Templates/Default.aspx?cn=drop-down&sid=65cf1383-7ad7-4e9d-8372-b3fd4c0ea155
Inform me if you have other questions.
Can you please provide working sample?
Yes i reproducet it. It is caused because of the missing "groupid". Is it an option for you to use a single image for every item like
<
ItemTemplate>
/>
<%
)%>
>