|
Rank: Advanced Member Groups: Member
Joined: 9/2/2010 Posts: 120
|
Hi,
In a grid control I put a button column. In some rows I need hide the button to the user can not press it. How can I do this?
Regards, Camarate
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You can do that with conditional formatting: http://demo.essentialobjects.com/Demos/Grid/Features/Conditional%20Formatting%20-%20Cell%20Based/Demo.aspxBasically the button will still be there, but you would apply a different style so that it is not visible. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/2/2010 Posts: 120
|
Hi, Thanks for quickly reply. I tried your suggestions but not worked. I'm using image buttons, as shown in the tips http://www.essentialobjects.com/forum/postst4806_Image-Button-in-Grid.aspx posted in this forum. What I want is shown in the picture below, the Adobe Reader button on the second line would not be available and isn't visible. Can you help me, please. Regards, Camarate
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Camarate wrote:I tried your suggestions but not worked. Hi, Please reply with detailed information about what you have tried and post test code if possible. It should work but if you just say it does not work, then the only thing we can tell you is "it does work". However if you can post enough information about exactly how and what you tried, we will be able to help you further. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/2/2010 Posts: 120
|
Hi, Thanks for your reply. Because the English is not my native language, I may not have expressed me properly in the last post. So I apologize. I did not understand clearly your suggestion. So, see the VB code below, which is the routine which the Grid control is loaded.
Code: Visual Basic.NET
GridRow = Me.grdData.CreateItem()
If Conn.DefaultDataReader("DOCU_NM_DOCUMENT_PDF") Is DBNull.Value Then
GridRow.Cells("PDF").Value = ""
Else
GridRow.Cells("PDF").Value = GLMEnv.UploadFolder & Conn.DefaultDataReader("DOCU_NM_DOCUMENT_PDF")
End If
GridRow.Cells("DOCU_SQ_DOCUMENT").Value = Conn.DefaultDataReader("DOCU_SQ_DOCUMENT")
GridRow.Cells("DOCU_NM_DOCUMENT_TYPE").Value = Conn.DefaultDataReader("DOCU_NM_DOCUMENT_TYPE")
Me.grdData.Items.Add(GridRow)
The GridRow.Cells ("PDF") is the cell that I want transform in invisible if the database field "DOCU_NM_DOCUMENT_PDF" is null. The ASP.NET HTML code that define the fields is below:
Code: HTML/ASPX
<eo:ButtonColumn AllowResize="False" ButtonText="<img border="0" src="../GLM/images/pdf16.png"/>"
CommandName="PDF" Name="PDF" Width="20">
<CellStyle CssText="TEXT-ALIGN: left; BACKGROUND-COLOR: #f2ffff; COLOR: #336699; PADDING-TOP: 2px" />
<eo:StaticColumn DataType="String" HeaderText="Tipo" Name="DOCU_NM_DOCUMENT_TYPE"
ReadOnly="True" Width="220">
</eo:StaticColumn>
<eo:StaticColumn DataType="String" HeaderText="Agência/Orgão" Name="DOCU_NM_AGENCY"
ReadOnly="True" Width="220">
<CellStyle CssClass="" />
</eo:StaticColumn>
I hope this informations are sufficient to you understand my problem. Regards, Camarate
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
That is not what we suggested. We suggested you to use different styles for rows you want to hide. The style is the CSS class that is applied on your cell. You can let the Grid to apply different CSS class on different cell based on the cell data.
Please follow the previous sample we posted for more details about how to use this feature. You may want to check the sample's source code to see how it works. If you have any questions about the sample code please feel free to ask. However you must follow where we ask you go first.
Thanks
|
|