Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
dataGrid ItemTemplate question
I have created a dataGrid on a web form using VB.Net. Here is what I am trying to do...
The first column in the dataGrid I have created an ItemTemplate. What I would like for it to do is either display a textbox or a label. Basically, if there is a name in the recordset I pulled from my stored procedure, print it out. If not, I want a textbox to display with the text Vacant Slot. I am getting it to either print the name or the words "Vacant Slot" but I can't get it to show up in a textbox. Any suggestions?? Thanks in advance.
this is from my html page.....
<%# RenderNameField(Databinder.Eval (Container, "DataItem.vacancy_flag"),Databinder.Eval
(Container, "DataItem.Name")) %>
this is from my codebehind page......
Function RenderNameField(ByVal sVacantFlag As String, ByVal sText As
String) As String
If Not Convert.ToBoolean(Byte.Parse(sVacantFlag)) Then
Return "" & sText & ""
Return "Vacant Slot"
0 · ·