简体   繁体   中英

Binding data to grid view is not working

In the below code i have get 2 variable in a session and i am tried to bind values in custom control by passing client id and in another case i tried to bind another values to grid view by passing doumnet id .But custom controls are binded successfully but grid view cant able to bind it throws error.pls help me to solve the issue

pageload:

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var SearchDoc = (SearchDoc)Session["Documentname"];
                var oDocumentID = SearchDoc.ClientID;
                var odoc = SearchDoc.DocumentID;
                DocumentServiceClient Doc = new DocumentServiceClient();
                DataSet dsField = Doc.GetClientFields(oDocumentID);
                DataSet dsField1 = Doc.GetDocumentsByDocumentID(odoc);//
                gmaFieldsContr.dtFieldsInfo = dsField.Tables[0];
                gmaFieldsContr.BindData();
                Attchdwnld.DataSource = dsField1.Tables[0];
                Attchdwnld.DataBind();}}

I solve the issue

 var SearchDoc = (SearchDoc)Session["Documentname"];
                var oDocumentID = SearchDoc.ClientID;
               string odoc = SearchDoc.DocumentID.ToString();
                DocumentServiceClient Doc = new DocumentServiceClient();
                DataSet dsField = Doc.GetClientFields(oDocumentID);
                DataTable dtDocument = Doc.GetDocumentsByDocumentID(odoc).Tables[0];
                gmaFieldsContr.dtFieldsInfo = dsField.Tables[0];
                gmaFieldsContr.BindData();
                Attchdwnld.DataSource = dtDocument; 
                Attchdwnld.DataBind();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM