This is a migrated thread and some comments may be shown as answers.

Radgridview column values

12 Answers 180 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Somnath
Top achievements
Rank 1
Somnath asked on 09 Feb 2011, 02:42 PM
Hi

Let me know any way to handle following situation...

I have a radgridview (haveing Binding Source) with five columns,One of them is "Posted" which has 'Yes' and 'No' values only...

If value of "Posted" is 'Yes' then that perticular row should be disabled.....(otherwise row should  Enabled)

Please suggest me any Solution..

Thank You

12 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 09 Feb 2011, 02:54 PM
Hello Somnath,

You can achieve this using the RowFormatting event. Please consider the following code:

Private Sub RadGridView1_RowFormatting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.RowFormattingEventArgs) Handles RadGridView1.RowFormatting
    If e.RowElement.RowInfo.Index > -1 AndAlso e.RowElement.RowInfo.Cells("Posted").Value IsNot Nothing Then
        If String.Equals(e.RowElement.RowInfo.Cells("Posted").Value.ToString().ToUpperInvariant(), "YES") Then
            e.RowElement.Enabled = False
        Else
            e.RowElement.Enabled = True
        End If
    End If
End Sub

Hope that helps
Richard
0
Somnath
Top achievements
Rank 1
answered on 09 Feb 2011, 04:05 PM
Hello Richard
Please give me any example of Radinputbox

Thank for your Solutions


0
Richard Slade
Top achievements
Rank 2
answered on 09 Feb 2011, 04:08 PM
Hello Somnath,

Please could you expand on this question as I am unsure as to your requirement
thanks
Richard
0
Somnath
Top achievements
Rank 1
answered on 09 Feb 2011, 04:17 PM
Hello

Within Wincontrol we have Inputbox
e.g

string

 

 

sTemplateName = Microsoft.VisualBasic.Interaction.InputBox("Enter Template Name", "", "", -1, -1);

 


Is inputbox avilable in Radcontrols,If Yes give me Example.....

Thank You
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 09 Feb 2011, 04:23 PM
Hello Somnath,

Telerik do not have an InputBox, but this question was raised once before, and I created a basic exmaple using Telerik Controls. You can find my answer here

Hope that helps
Richard
0
Somnath
Top achievements
Rank 1
answered on 10 Feb 2011, 08:51 AM
Hello

Can you Provide me Exact link to your basic Example,Please

Thanks
0
Richard Slade
Top achievements
Rank 2
answered on 10 Feb 2011, 09:56 AM
Hello Somnath, 

As per my post above. This is the link: http://www.telerik.com/community/forums/winforms/new-product-suggestions/inputbox.aspx#1453186

Regards, 
Richard
0
Somnath
Top achievements
Rank 1
answered on 23 Feb 2011, 08:18 AM

Hello Richard

The link provided by You doesn't open from my computer..
Instead Can you provide Exact code of InputBox...

Thank You
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 23 Feb 2011, 09:53 AM
Hello Somnath,

Here is the code as requested

Imports Telerik.WinControls 
Imports Telerik.WinControls.UI 
    
Public Class RadInputBox 
    
    Shared Function Show(ByVal Prompt As String, ByVal Title As String, Optional ByVal DefaultResponse As String = "") As String
        Dim inputBox As New RadInputBoxInternal() 
        inputBox.StartPosition = FormStartPosition.CenterParent 
        inputBox.LabelQuestion.Text = Prompt 
        inputBox.Text = Title 
    
        If inputBox.ShowDialog() = DialogResult.OK Then
            Return inputBox.TextBoxInput.Text 
        Else
            Return DefaultResponse 
        End If
    End Function
    
    Private Class RadInputBoxInternal 
        Inherits Telerik.WinControls.UI.RadForm 
    
        Friend Sub New() 
            Me.InitializeComponent() 
        End Sub
    
        <System.Diagnostics.DebuggerNonUserCode()> _ 
        Protected Overrides Sub Dispose(ByVal disposing As Boolean
            Try
                If disposing AndAlso components IsNot Nothing Then
                    components.Dispose() 
                End If
            Finally
                MyBase.Dispose(disposing) 
            End Try
        End Sub
    
        Private components As System.ComponentModel.IContainer 
    
        <System.Diagnostics.DebuggerStepThrough()> _ 
        Private Sub InitializeComponent() 
            Me.ButtonOk = New Telerik.WinControls.UI.RadButton() 
            Me.ButtonCancel = New Telerik.WinControls.UI.RadButton() 
            Me.TextBoxInput = New Telerik.WinControls.UI.RadTextBox() 
            Me.LabelQuestion = New Telerik.WinControls.UI.RadLabel() 
            CType(Me.ButtonOk, System.ComponentModel.ISupportInitialize).BeginInit() 
            CType(Me.ButtonCancel, System.ComponentModel.ISupportInitialize).BeginInit() 
            CType(Me.TextBoxInput, System.ComponentModel.ISupportInitialize).BeginInit() 
            CType(Me.LabelQuestion, System.ComponentModel.ISupportInitialize).BeginInit() 
            CType(Me, System.ComponentModel.ISupportInitialize).BeginInit() 
            Me.SuspendLayout() 
            
            'ButtonOk 
            
            Me.ButtonOk.Location = New System.Drawing.Point(342, 12) 
            Me.ButtonOk.Name = "ButtonOk"
            Me.ButtonOk.Size = New System.Drawing.Size(97, 24) 
            Me.ButtonOk.TabIndex = 0 
            Me.ButtonOk.Text = "Ok"
            
            'ButtonCancel 
            
            Me.ButtonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel 
            Me.ButtonCancel.Location = New System.Drawing.Point(342, 42) 
            Me.ButtonCancel.Name = "ButtonCancel"
            Me.ButtonCancel.Size = New System.Drawing.Size(97, 24) 
            Me.ButtonCancel.TabIndex = 1 
            Me.ButtonCancel.Text = "Cancel"
            
            'TextBoxInput 
            
            Me.TextBoxInput.Location = New System.Drawing.Point(13, 87) 
            Me.TextBoxInput.Name = "TextBoxInput"
            Me.TextBoxInput.Size = New System.Drawing.Size(426, 20) 
            Me.TextBoxInput.TabIndex = 2 
            Me.TextBoxInput.TabStop = False
            
            'LabelQuestion 
            
            Me.LabelQuestion.AutoSize = False
            Me.LabelQuestion.Location = New System.Drawing.Point(13, 12) 
            Me.LabelQuestion.Name = "LabelQuestion"
            Me.LabelQuestion.Size = New System.Drawing.Size(323, 69) 
            Me.LabelQuestion.TabIndex = 3 
            Me.LabelQuestion.Text = "text"
            
            'RadForm1 
            
            Me.AcceptButton = Me.ButtonOk 
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) 
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 
            Me.CancelButton = Me.ButtonCancel 
            Me.ClientSize = New System.Drawing.Size(451, 119) 
            Me.Controls.Add(Me.LabelQuestion) 
            Me.Controls.Add(Me.TextBoxInput) 
            Me.Controls.Add(Me.ButtonCancel) 
            Me.Controls.Add(Me.ButtonOk) 
            Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog 
            Me.MaximizeBox = False
            Me.MinimizeBox = False
            Me.Name = "RadInputInternal"
            
            
            
            Me.RootElement.ApplyShapeToControl = True
            Me.Text = "RadInputInternal"
            CType(Me.ButtonOk, System.ComponentModel.ISupportInitialize).EndInit() 
            CType(Me.ButtonCancel, System.ComponentModel.ISupportInitialize).EndInit() 
            CType(Me.TextBoxInput, System.ComponentModel.ISupportInitialize).EndInit() 
            CType(Me.LabelQuestion, System.ComponentModel.ISupportInitialize).EndInit() 
            CType(Me, System.ComponentModel.ISupportInitialize).EndInit() 
            Me.ResumeLayout(False
            Me.PerformLayout() 
    
        End Sub
        Friend WithEvents ButtonOk As Telerik.WinControls.UI.RadButton 
        Friend WithEvents ButtonCancel As Telerik.WinControls.UI.RadButton 
        Friend WithEvents TextBoxInput As Telerik.WinControls.UI.RadTextBox 
        Friend WithEvents LabelQuestion As Telerik.WinControls.UI.RadLabel 
    
        Private Sub RadForm1_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown 
            Me.TextBoxInput.SelectionLength = 0 
            Me.TextBoxInput.Focus() 
        End Sub
    
        Private Sub ButtonCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCancel.Click 
            Me.DialogResult = Windows.Forms.DialogResult.Cancel 
            Me.Close() 
        End Sub
    
        Private Sub ButtonOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOk.Click 
            Me.DialogResult = DialogResult.OK 
            Me.Close() 
        End Sub
    
    End Class
End Class

and you can call it like so.
Private Sub RadButton1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButton1.Click 
    Me.RadTextBox1.Text = RadInputBox.Show("What's your name?", "Name"
End Sub

Hope you find that helpful
Richard
0
Somnath
Top achievements
Rank 1
answered on 01 Mar 2011, 06:55 AM
HI Richard
Can you help in following issue.....

I have a gridview with 5 Columns And having with a Binding source....

When I insert values into new row (index=-1) And press Enter key Then
new row added in grid view....

I want same scenario when  I click Insert button...

Thank You
0
Richard Slade
Top achievements
Rank 2
answered on 01 Mar 2011, 11:07 AM
Hi Somnath,

Depending on your binding source, you should be able to just add the item to the binding source and it will appear in your grid.
Regards,
Richard
0
Stefan
Telerik team
answered on 02 Mar 2011, 02:26 PM
Hi Somnath,

Please find the answer to your question in the other thread that you have opened "Add new row".

If you want to add rows through the binding source, they will appear in RadGridView automatically, just like Richard said.

I would also like to suggest to get familiar with point 4 from the thread "important information on using Telerik forums", which suggests to keep one subject per thread (when possible).

Please also avoid posting repetitive questions across several threads, since this slows down our response time.

Greetings,
Stefan
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Somnath
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Somnath
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or