System.Web.UI.WebControls.FormView.DataBind C# (CSharp) Method

DataBind() public final method

public final DataBind ( ) : void
return void
		public sealed override void DataBind ()
		{
			cachedKeyProperties = null;
			base.DataBind ();
			
			if (pageCount > 0) {
				if (CurrentMode == FormViewMode.Edit)
					oldEditValues = new DataKey (GetRowValues (true));
				FillRowDataKey (dataItem);
				key = new DataKey (KeyTable);
			}
		}
		

Usage Example

 public FormView BindFormView(FormView grdVGenIn, string strSqlIn)
 {
     objConnection = open_connection();
     if (open_con == true)
     {
         try
         {
             objDataSet = new DataSet();
             objAdapter = new OracleDataAdapter(strSqlIn, objConnection);
             objAdapter.Fill(objDataSet, "tblGrdV");
             grdVGenIn.DataSource = objDataSet.Tables["tblGrdV"].DefaultView;
             grdVGenIn.DataBind();
             gridView_bind = true;
             return grdVGenIn;
         }
         catch (OracleException objError)
         {
             if (objError.Message.Substring(0, 21) == "Table does not exist.")
             {
                 ErrorStr = ErrorMsg(objConnection, "MSG1201");
             }
             else if (objError.Message.Substring(59, 25) == "ORA-00904: invalid column name")
             {
                 ErrorStr = ErrorMsg(objConnection, "MSG1202");
             }
             else
             {
                 ErrorStr = objError.Message;
                 err_flag = true;
             }
             gridView_bind = false;
             return null;
         }
         finally
         {
             objConnection.Close();
             objConnection.Dispose();
             objAdapter.Dispose();
         }
     }
     else
     {
         return null;
     }
 }
All Usage Examples Of System.Web.UI.WebControls.FormView::DataBind