Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Burak #1
How to prevent a checkbox from showing up in a datagrid with no records?
Hello,
I have a datagrid made up of two columns, the first has a checkbox in
it and the other holds a job id.
<Columns>
<asp:TemplateColumn HeaderText="Select"
HeaderStyle-HorizontalAlign="Center"
ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:CheckBox ID="chkIncomplete" Runat="server"> </asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn HeaderText="VJC Ref#" SortExpression="JOB_ID"
DataField="JOB_ID" HeaderStyle-HorizontalAlign="Center"
ItemStyle-HorizontalAlign="Center"></asp:BoundColumn>
</columns>
When there are no job ids, I insert a blank row into the grid from
the code behind
row(1) = "No active job orders have been saved"
ds.Tables(0).Rows.InsertAt(row, 0)
dtgActive.DataSource = ds.Tables(0)
dtgActive.DataBind()
when I do this however, the checkbox also shows up.
How can I prevent the checkbox from showing up?
Thank you,
Burak
Burak Guest
-
How can I prevent SmartTag from showing?
Hi, I've a webcontrol which inherited from BaseValidator. Under the .Net 2.0, such control has a default function----SmartTag, which is new in... -
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the... -
How to prevent past dates from showing
I had the same question and have tried the above. The test works fine, but it shows all the dates incl. the past. How do I define the current date... -
datagrid with no records - showing a line
Hi everyone, Using asp.net and a datagrid - When there are no records returned from the query - is there a way to add/insert a line into the... -
I want to prevent accidental updates to records
I am running Access 2000. I would like to put a simple check box on a form so that if the box is checked that record cannot be edited. If you... -
Scott Mitchell [MVP] #2
Re: How to prevent a checkbox from showing up in a datagrid withno records?
> When there are no job ids, I insert a blank row into the grid from
There are a couple options. One would be to set the checkbox column's> the code behind
>
> row(1) = "No active job orders have been saved"
> ds.Tables(0).Rows.InsertAt(row, 0)
> dtgActive.DataSource = ds.Tables(0)
> dtgActive.DataBind()
>
> when I do this however, the checkbox also shows up.
>
> How can I prevent the checkbox from showing up?
Visible property to False. That is, *before* you call DataBind, do:
dtgActive.Columns(0).Visible = False
When the DataGrid is rendered, it will only have one column. If you
still want the checkbox's column there, but without the checkbox, you'll
need to programmatically reference the checkbox in the TEmplateColumn
and set its Visible property to false. More information on
programmatically referencing Web controls in a TemplateColumn can be
found here:
[url]http://datawebcontrols.com/faqs/ProgrammaticAccess/AccessingTemplateColumnContents.shtml[/url]
Happy Programming!
--
Scott Mitchell
[email]mitchell@4guysfromrolla.com[/email]
[url]http://www.4GuysFromRolla.com[/url]
[url]http://www.ASPFAQs.com[/url]
[url]http://www.ASPMessageboard.com[/url]
* When you think ASP, think 4GuysFromRolla.com!
Scott Mitchell [MVP] Guest



Reply With Quote

