Intersoft WebGrid Documentation
SetSelectedObject Method
See Also  Example Send Feedback
ISNet.WebUI.WebGrid Namespace > WebGrid Class : SetSelectedObject Method






selObj
Set selected row from server side.

Syntax

Visual Basic (Declaration) 
Public Sub SetSelectedObject( _
   ByVal selObj As SelectedObject _
) 
Visual Basic (Usage)Copy Code
Dim instance As WebGrid
Dim selObj As SelectedObject
 
instance.SetSelectedObject(selObj)
C# 
public void SetSelectedObject( 
   SelectedObject selObj
)
Delphi 
public procedure SetSelectedObject( 
    selObj: SelectedObject
); 
JScript 
public function SetSelectedObject( 
   selObj : SelectedObject
);
Managed Extensions for C++ 
public: void SetSelectedObject( 
   SelectedObject* selObj
) 
C++/CLI 
public:
void SetSelectedObject( 
   SelectedObject^ selObj
) 

Parameters

selObj

Example

 
C#Copy Code
private void WebGrid1_InitializeDataSource(object sender,
ISNet.WebUI.WebGrid.DataSourcEventArgs e)
{
    oleDbDataAdapter1.Fill(dsNorthWindEnt1.Customers);
    e.DataSource = dsNorthWind1;
}
 
private void WebGrid1_Load(object sender, System.EventArgs e)
{
    if (!IsPostBack)
    {
        // always select first row on first page load
        WebGrid1.SetSelectedObject(new SelectedObject(WebGrid1.RootTable, 0));
                
        // set focus to grid
        WebGrid1.SetFocus();
                
        // in v3.5, this event indicates that the datasource has been populated
        // and rows has been loaded so you can access row's value directly.
        // let's try to change the second row's style.
        WebGrid1.RootTable.Rows[1].Style.BackColor = Color.AliceBlue;
                
        // access to cell
        WebGrid1.RootTable.Rows[2].Cells[0].Text = "New Text";
    }
}

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.