dshi15
asked on
gridview buttonfield invisible
Hi Expert,
I have a Gridview which show all customer name address etc, CustomerId is key, and a buttonfield called "View Detail", I want "View Detail" buttonfield invisible if no order related this customerId, how I can do it?
Thanks in advance
I have a Gridview which show all customer name address etc, CustomerId is key, and a buttonfield called "View Detail", I want "View Detail" buttonfield invisible if no order related this customerId, how I can do it?
Thanks in advance
ASKER
Thanks, I used ButtonField
<asp:ButtonField Text="View" ButtonType="Button" CommandName="View Detail" >
Do I need change to TemplateField?
<asp:ButtonField Text="View" ButtonType="Button" CommandName="View Detail" >
Do I need change to TemplateField?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I got an error in this line
Dim CustomerId As String = GridView1.DataKeys(e.Row.R owIndex).V alue.ToStr ing()
"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"
I need use this CustomerId to check Order table if no reture I can Set
e.Row.Cells(0).Visible = False
Dim CustomerId As String = GridView1.DataKeys(e.Row.R
"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"
I need use this CustomerId to check Order table if no reture I can Set
e.Row.Cells(0).Visible = False
ASKER
thanks, i forgot this line
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowType = DataControlRowType.DataRow
ASKER
but I put e.Row.Cells(0).Visible = False
this row not line up correct, it moved to one column left
this row not line up correct, it moved to one column left
is ur button invisible ?
Yes,Dat might happen when u use buttonfield since it doesnt got id so hiding a cell m8 cause dis problem
Using template field will make ur job easier . Where u r hiden a button only . Worth trying by dat way which is flexible .
Yes,Dat might happen when u use buttonfield since it doesnt got id so hiding a cell m8 cause dis problem
Using template field will make ur job easier . Where u r hiden a button only . Worth trying by dat way which is flexible .
Well i used some short form of message last time apologise for dat .
"Yes,that might happen when u use asp:buttonfield since it does not got id , so hiding a cell might cause dis problem
Using template field will make your job easier , Where u r hiding a button only on the cell . Worth trying by dat way which is flexible ."
Meeran03
"Yes,that might happen when u use asp:buttonfield since it does not got id , so hiding a cell might cause dis problem
Using template field will make your job easier , Where u r hiding a button only on the cell . Worth trying by dat way which is flexible ."
Meeran03
u ve to use :
RowDataBound
Open in new window