This is a migrated thread and some comments may be shown as answers.

Dynamic Update/Delete Link

7 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 14 Jul 2008, 05:17 PM
hi

I am wondering how do I hide the update link in the RadGrid based on certain conditions.

what i have with this code:

</

EditItemTemplate>

<ItemTemplate>

<a href="#" onclick="openRadWindow2('<%#DataBinder.Eval(Container.DataItem,"vourcherid")%>'); return false;">Update</a>

</ItemTemplate>

</telerik:GridTemplateColumn>

</Columns>

I want to hide or disable this Update link in the grid when the value is null. Thanks

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 15 Jul 2008, 06:24 AM

Hi Lui Nai Wah,

Try with the following approach and see whether it helps.

ASPX:

<href="#" visible='<%# DataBinder.Eval (Container.DataItem,"vourcherid")!=null?true:false %>' onclick="openRadWindow2('<%#DataBinder.Eval(Container.DataItem,"vourcherid")%>'); return false;">Update</a>   
 


Thanks
Princy.
0
L
Top achievements
Rank 1
answered on 15 Jul 2008, 08:18 AM
hi

I tried using the sugessted solution and it gave me this error:

Overload resolution failed because no accessible 'ToString' accepts this number of arguments

I tried also:

</

EditItemTemplate>

<ItemTemplate>

<a href="#" visible='<%# IIF(DataBinder.Eval(Container.DataItem,"voucherID") is nothing,True,False)%>' onclick="openRadWindow2('<%#DataBinder.Eval(Container.DataItem,"voucherID")%>'); return false;">Update</a>
</ItemTemplate>
</telerik:GridTemplateColumn>

No error but the Update link is still there. Thanks

0
L
Top achievements
Rank 1
answered on 15 Jul 2008, 05:41 PM
hi

How do i format the " " in the text property of this label? Thanks

<asp:Label ID="Label2" visible='<%# IIF(DataBinder.Eval (Container.DataItem,"voucherid") is nothing,True,false) %>' runat="server" Text="<a href="#" onclick="openRadWindow2('<%#DataBinder.Eval(Container.DataItem,"voucherid")%>'); return false;">Update</a>"></asp:Label>

I first tested with this:

<asp:Label ID="Label2" visible='<%# IIF(DataBinder.Eval (Container.DataItem,"voucherid") is nothing,True,false) %>' runat="server" Text="<a href=http://www.microsoft.com>Update</a>" 
 
and it work.

0
Accepted
Iana Tsolova
Telerik team
answered on 16 Jul 2008, 03:14 PM
Hello Lui Nai Wah,

Try the following code instead:

<asp:Label ID="LinkButton1" runat="server"    
    Visible='<%# IIf(DataBinder.Eval(Container.DataItem, "voucherID") is Nothing, "true", "false")%>'>  
     <href="#" onclick="openRadWindow2('<%#DataBinder.Eval(Container.DataItem,"voucherID")%>'); return false;">Update</a> 
</asp:Label> 

Let us know if any issues arise.

Regards,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
L
Top achievements
Rank 1
answered on 16 Jul 2008, 05:04 PM
hi

still it didn't work.

I am wondering surely someone has posted similar requirement while using radwindow.

It cannot be that while i am required to use radwindows with javascripts and yet i am not able to hide or disable it based on certain conditions. Strange?

I am frustrated...

Help me if you can. Thanks a million.
0
Accepted
Iana Tsolova
Telerik team
answered on 18 Jul 2008, 09:44 AM
Hi Lui Nai Wah,

Please find attached a sample project with the desired functionality implemented. Try it on your end and let me know if it works as expected.

If any issues arise, do not hesitate to ask.

Regards,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
L
Top achievements
Rank 1
answered on 28 Jul 2008, 09:30 AM
hi

Thanks for the solution.
Tags
Grid
Asked by
L
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
L
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or