D'Arcy from Winnipeg
Solution Architecture, Business & Entrepreneurship, Microsoft, and Adoption

All I want is to set the text of a button...

Tuesday, December 6, 2005 6:45 AM

I have an Infragistics UltraWinGrid. I have an unbound column I've set up to display the button. The button shows up at run time, and responds to the events I have hooked up. Happiness.

Now, all I want to do is CHANGE THE TEXT ON THE BUTTON. I was hoping there would be a 'text' property in the CellButtonAppearance set, but no luck. Does anyone know how to do this?!

/me glances over in the direction of Devin.

;)

D




Feedback

# re: All I want is to set the text of a button...

You do this by handling the InitializeRow event on the grid and then setting the "value" of the column.

private void grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
e.Row.Cells["Button"].Value="Click me";
}


Hope that helps! 12/6/2005 7:03 AM | Robert

# re: All I want is to set the text of a button...

Just checking to see if the above solution worked for you. 12/6/2005 6:37 PM | Devin

# re: All I want is to set the text of a button...

Robert: Thanks for the post, it worked like a charm.

Devin: Yeah, that did the trick. Thanks for checking back about it though. :) 12/6/2005 6:39 PM | D'Arcy from Winnipeg

# re: All I want is to set the text of a button...

Hi,

I faced the similar problem to set the Text of button. You have to set the Text in NullText property of the Unbound column.

I have a button but the appearence of the button is just like text column. Can I get some info How should I make the button appear like any other windows button?

Regards,
Sandeep Shivathaya 11/15/2006 12:16 AM | Sandeep Shivathaya

# re: All I want is to set the text of a button...

If you're still interested, to make the button appear all the time you have to set the column's ButtonDisplayStyle to Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always

that should do the trick.

Thanks
Karl. 12/21/2006 2:14 PM | Karl

# re: All I want is to set the text of a button...

Cells["Button"] doesn't work for me as "Button" isn't a valid index. Setting nulltext just sets the text in new rows, and not buttons. Maybe it makes a difference that my columns have datasources (i.e. are bound). Is there any other way to set the text on a button? 1/18/2007 1:12 AM | Richard

# re: All I want is to set the text of a button...

Richard,
Cells["Button"] is just an example. If the key of your column is "Customer", put that in instead of "Button".

E.g.

UltraGridCell c = e.Row.Cells["Whatever"];
c.Value = "Edit";
2/14/2007 3:57 AM | Kevin

# re: All I want is to set the text of a button...

I have a different scecnario. The column style is set to ColumnStyle.EditButton

Now, based upon the value of a particular row, i need to set a text on the edit button of that column.

How to achive this... any body can help me.
3/21/2007 12:47 AM | Ayan

# re: All I want is to set the text of a button...

This is not exactly good..
(or what am I doing wrong??)

I can set values only in InitializeRow event in unbound column - later on if I try to modify the value of any cell in unbound column - it fails to update the value.. why? 7/31/2007 3:41 PM | ameyagholap@yahoo.com

# re: All I want is to set the text of a button...

How to dispaly text on cell button. 2/20/2008 9:01 AM | kalash jain

# re: All I want is to set the text of a button...

Even text in that button is not displayed 11/17/2009 7:23 AM | Krisha

# re: All I want is to set the text of a button...


' Front End Code.
Private Sub udgBudgetDetails_ClickCellButton(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CellEventArgs) Handles udgBudgetDetails.ClickCellButton

If e.Cell.Column.Key = "QuantityPerPeriod" Then
If DirectCast(e.Cell.Row.ListObject, OEExpRevDetail).QuantityPerPeriodBoolean = True Then
DirectCast(e.Cell.Row.ListObject, OEExpRevDetail).QuantityPerPeriodBoolean = False
Else
DirectCast(e.Cell.Row.ListObject, OEExpRevDetail).QuantityPerPeriodBoolean = True
End If
End If

End Sub

' Object Layer Created a dummy property that returns the string. A bit of a hack but it works

<Browsable(False)> _
Public Property QuantityPerPeriodBoolean() As Boolean
Get
Return mQuantityPerPeriod
End Get
Set(ByVal value As Boolean)
If mQuantityPerPeriod <> value Then
mQuantityPerPeriod = value
PropertyHasChanged("QuantityPerPeriod")
PropertyHasChanged("QuantityPerPeriodBoolean")
End If
End Set
End Property

<DisplayNameAttribute("Quantity Per Period")> _
Public Property QuantityPerPeriod() As Object
Get
'Return mQuantityPerPeriod
If mQuantityPerPeriod = True Then
Return "Per Period"
Else
Return "All Periods"
End If
End Get
Set(ByVal Value As Object)


End Set
End Property 7/28/2011 11:35 AM | bruce

# re: All I want is to set the text of a button...

Pretty interesting idea, thanks for pointing it out to us. 1/14/2012 7:27 AM | vandenberg schmuck

# re: All I want is to set the text of a button...

This is the correct way to provide caption for button

ultradatagridReferenceobj.DisplayLayout.Bands(0).AddButtonCaption = "add button text"

ultradatagridReferenceobj.DisplayLayout.Bands(0).AddButtonToolTipText = "add tooltip" 5/21/2012 1:14 AM | Sam

Post a comment