Wednesday, 15 June 2011

GRID ROW EDIT UPDATE CANCEL in Asp.net Pages or SharePoint Webparts

ASPX PAGE CODE:

    <asp:GridView ID="gvElectrode" CssClass="griddisplay" runat="server" AutoGenerateColumns="False"
                ShowFooter="True" BorderColor="#cccccc" BorderWidth="1px" HorizontalAlign="Center"
                OnRowCancelingEdit="gvElectrode_RowCancelingEdit" OnRowEditing="gvElectrode_RowEditing"
                OnRowUpdating="gvElectrode_RowUpdating" DataKeyNames="ElectrodeID" OnPageIndexChanging="gvElectrode_PageIndexChanging"
                OnRowDataBound="gvElectrode_RowDataBound" OnRowCommand="gvElectrode_Rowcommand" PageSize="20">
                <Columns>
                    <asp:TemplateField HeaderText="S No." SortExpression="Name" ItemStyle-Width="40px">
                        <EditItemTemplate>
                            <%# Container.DataItemIndex + 1 %>
                        </EditItemTemplate>
                        <FooterTemplate>
              
                        </FooterTemplate>
                        <ItemTemplate>
                            <%# Container.DataItemIndex + 1 %>
                        </ItemTemplate>
                        <FooterStyle HorizontalAlign="Left" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="3D Final Electrode Design" SortExpression="Name" ItemStyle-Width="300px">
                        <EditItemTemplate>
                            <div class="inputarea">
                                <div class="txtarealarge">
                                    <asp:FileUpload ID="fu3dElectrode" runat="server" Visible="true"  />
                                    <asp:Label ID="lblData3D" runat="server"><a href="#" onclick="g_varSkipRefreshOnFocus = true;editDocumentWithProgID2('<%# Eval("FilePath3d") %>', '', 'SharePoint.OpenDocuments', '0', '<%# Eval("URL") %>', '0')"><%# Eval("3DElectrode")%></a></asp:Label>
                                
                                 <%--   <asp:LinkButton ID="lnkbut3DCon" CommandName="delete3D" runat="server" Text="Delete"
                                        ForeColor="Red" Visible="true"></asp:LinkButton>--%>
                                    <asp:HiddenField ID="hdf3dCon" runat="server" Value='<%# Eval("DocuementID3d") %>' />
                              
                                    <asp:RequiredFieldValidator ID="rfv3d" runat="server" ControlToValidate="fu3dElectrode"
                                        ErrorMessage="Select the File" ValidationGroup="valid" Display="Dynamic">
                                    </asp:RequiredFieldValidator>
                                </div>
                            </div>
                            <div class="inputarea">
                                <div class="lblarea">
                                    <asp:Label ID="lblNotes3dE" runat="server" Text="Notes   :" CssClass="lblarea"></asp:Label></div>
                                <div class="txtarea">
                                    <asp:TextBox ID="txtNotes3dE" runat="server" Text='<%# Bind("3DFinalNotes") %>' TextMode="MultiLine"
                                        MaxLength="250" /></div>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                             <div class="inputarea">
                                <div class="txtarealarge">
                                    <asp:FileUpload ID="fu3dElectrode" runat="server" Visible="true"  />
                             
                              
                              
                                    <asp:RequiredFieldValidator ID="rfval1" runat="server" ControlToValidate="fu3dElectrode"
                                        ErrorMessage="Select the File" ValidationGroup="validate" Display="Dynamic">
                                    </asp:RequiredFieldValidator>
                                </div>
                            </div>
                            <div class="inputarea">
                                <div class="lblarea">
                                    <asp:Label ID="lblNotes3dF" runat="server" Text="Notes   :" CssClass="lblarea"></asp:Label></div>
                                <div class="txtarea">
                                    <asp:TextBox ID="txtNotes3dF" runat="server"  TextMode="MultiLine"
                                        MaxLength="250" /></div>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <div class="inputarea">
                                <div class="txtarealarge">
                                  
                                    <asp:Label ID="lblData3D" runat="server"><a href="#" onclick="editDocumentWithProgID2('<%# Eval("FilePath3d") %>', '', 'SharePoint.OpenDocuments', '0', '<%# Eval("URL") %>', '0')"><%# Eval("3DElectrode")%></a></asp:Label>
                              
                                
                              
                             
                                </div>
                            </div>
                            <div class="inputarea">
                                <div class="lblarea">
                                    <asp:Label ID="lblNotes3dI" runat="server" Text="Notes   :" CssClass="lblarea"></asp:Label></div>
                                <div class="txtarea">
                                    <asp:Label ID="txtNotes3dI" runat="server" Text='<%# Bind("3DFinalNotes") %>'
                                        MaxLength="250" /></div>
                            </div>
                        </ItemTemplate>
                        <FooterStyle HorizontalAlign="Left" />
                    </asp:TemplateField>




                      <asp:TemplateField HeaderText="2D Final Electrode Design" SortExpression="Name" ItemStyle-Width="300px">
                        <EditItemTemplate>
                            <div class="inputarea">
                                <div class="txtarealarge">
                                    <asp:FileUpload ID="fu2dElectrode" runat="server"  Visible="true"  />
                                    <asp:Label ID="lblData2D" runat="server"><a href="#" onclick="g_varSkipRefreshOnFocus = true; editDocumentWithProgID2('<%# Eval("FilePath2d") %>', '', 'SharePoint.OpenDocuments', '0', '<%# Eval("URL") %>', '0')"><%# Eval("2DElectrode")%></a></asp:Label>
                              
                                   <%-- <asp:LinkButton ID="lnkbut2DCon" CommandName="delete2D" runat="server" Text="Delete"
                                        ForeColor="Red" Visible="true"></asp:LinkButton>--%>
                                    <asp:HiddenField ID="hdf2dCon" runat="server" Value='<%# Eval("DocuementID2d") %>' />
                              
                                    <asp:RequiredFieldValidator ID="rfv2d" runat="server" ControlToValidate="fu2dElectrode"
                                        ErrorMessage="Select the File" ValidationGroup="valid" Display="Dynamic">
                                    </asp:RequiredFieldValidator>
                                </div>
                            </div>
                            <div class="inputarea">
                                <div class="lblarea">
                                    <asp:Label ID="lblNotes2dE" runat="server" Text="Notes   :" CssClass="lblarea"></asp:Label></div>
                                <div class="txtarea">
                                    <asp:TextBox ID="txtNotes2dE" runat="server" Text='<%# Bind("2DFinalNotes") %>' TextMode="MultiLine"
                                        MaxLength="250" /></div>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                             <div class="inputarea">
                                <div class="txtarealarge">
                                    <asp:FileUpload ID="fu2dElectrode" runat="server" Visible="true"  />
                             
                              
                              
                                    <asp:RequiredFieldValidator ID="rfv2d" runat="server" ControlToValidate="fu2dElectrode"
                                        ErrorMessage="Select the File" ValidationGroup="validate" Display="Dynamic">
                                    </asp:RequiredFieldValidator>
                                </div>
                            </div>
                            <div class="inputarea">
                                <div class="lblarea">
                                    <asp:Label ID="lblNotes2dF" runat="server" Text="Notes   :" CssClass="lblarea"></asp:Label></div>
                                <div class="txtarea">
                                    <asp:TextBox ID="txtNotes2dF" runat="server"  TextMode="MultiLine"
                                        MaxLength="250" /></div>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <div class="inputarea">
                                <div class="txtarealarge">
                                  
                                    <asp:Label ID="lblData2D" runat="server"><a href="#" onclick="g_varSkipRefreshOnFocus = true; editDocumentWithProgID2('<%# Eval("FilePath2d") %>', '', 'SharePoint.OpenDocuments', '0', '<%# Eval("URL") %>', '0')"><%# Eval("2DElectrode")%></a></asp:Label>
                              
                                
                              
                             
                                </div>
                            </div>
                            <div class="inputarea">
                                <div class="lblarea">
                                    <asp:Label ID="lblNotes2dI" runat="server" Text="Notes   :" CssClass="lblarea"></asp:Label></div>
                                <div class="txtarea">
                                    <asp:Label ID="txtNotes2dI" runat="server" Text='<%# Bind("2DFinalNotes") %>' TextMode="SingleLine"
                                        MaxLength="250" /></div>
                            </div>
                        </ItemTemplate>
                        <FooterStyle HorizontalAlign="Left" />
                    </asp:TemplateField>
               
                    <asp:TemplateField HeaderText="Edit" ShowHeader="False" ItemStyle-Width="60px">
                        <EditItemTemplate>
                            <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="True" CommandName="Update"
                                ValidationGroup="validateEdit" ImageUrl="../_layouts/images/ExpressPLM/gridicon-floppy.gif" />
                            <asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="false" CommandName="Cancel"
                                ImageUrl="../_layouts/images/ExpressPLM/gridicon-pencil-x.gif" />
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:LinkButton ID="lnkAdd" runat="server" Text="Add" OnClick="lnkAdd_Click"
                                ValidationGroup="validate"></asp:LinkButton>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:ImageButton ID="ImageButton3" runat="server" CausesValidation="false" CommandName="Edit"
                                ImageUrl="../_layouts/images/ExpressPLM/gridicon-pencil.gif" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <%-- <asp:TemplateField HeaderText="Delete">
                                            <ItemTemplate>
                                                   <asp:ImageButton ID="ImageButton4" runat="server" CausesValidation="false" CommandName="Delete" ImageUrl="~/Images/griddelete.gif" />
                                            </ItemTemplate>
                                              <ItemStyle  HorizontalAlign="Center"/>
                                            <HeaderStyle  HorizontalAlign="Center"/>
                                        </asp:TemplateField>--%>
                </Columns>
                <EmptyDataTemplate>
                </EmptyDataTemplate>
                <FooterStyle HorizontalAlign="Center" />
            </asp:GridView>


CODE BEHIND CS FILE:

        #region Grid Events


        #region Add new
        /// <summary>
        /// Adding the new role to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lnkAdd_Click(object sender, EventArgs e)
        {
            try
            {
                SPListItemCollection slcollElectrode = slElectrodeDesign.Items;
                SPListItem slitemElectrode = slcollElectrode.Add();
                if (Page.IsValid)
                {
                    TextBox txtNotes3dF = (TextBox)gvElectrode.FooterRow.FindControl("txtNotes3dF");
                    TextBox txtNotes2dF = (TextBox)gvElectrode.FooterRow.FindControl("txtNotes2dF");
                    FileUpload  fu3dElectrode        =(FileUpload)gvElectrode.FooterRow.FindControl("fu3dElectrode");
                    FileUpload fu2dElectrode = (FileUpload)gvElectrode.FooterRow.FindControl("fu2dElectrode");
                    slitemElectrode["Final2DAttachment"]=txtNotes2dF.Text.Trim();
                    slitemElectrode["Final3DAttachment"]=txtNotes3dF.Text.Trim();
                    //Need to discuss what kind of status will be maintained
                    slitemElectrode["Status"]="Save";
                    slitemElectrode["MTFGBOMNO"] = objBusinessEntity.GetLookupValue(objBusinessEntity.MTFGBOM, "MTFGBOMNO", strMTFGBOMNO);
                    slitemElectrode.Update();
                    int intItemID = slitemElectrode.ID;

                    if (fu3dElectrode.PostedFile.FileName != string.Empty)
                    {
                        string file3Dretun = objBusinessEntity.SingleUpload(fu3dElectrode, objBusinessEntity.ElectrodeDesign, "3D_Electrode", intItemID.ToString(), objBusinessEntity.DesignDocument);
                    }
                    if (fu2dElectrode.PostedFile.FileName != string.Empty)
                    {
                        string file2Dretun = objBusinessEntity.SingleUpload(fu2dElectrode, objBusinessEntity.ElectrodeDesign, "2D_Electrode", intItemID.ToString(), objBusinessEntity.DesignDocument);
                    }

                    bindElectrodeDesign();
                   
                }
            }
            catch (Exception ex)
            {
               // ErrorLog.WriteError(ex.Message, "lnkAdd_Click");
            }
            finally
            {
               // FillRolesGrid();
            }
        }
        #endregion

        #region
        /// <summary>
        /// to cancel the editing of the role
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvElectrode_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
        {
            try
            {
                gvElectrode.EditIndex = -1;
                bindElectrodeDesign();
            }
            catch (Exception ex)
            {
               // ErrorLog.WriteError(ex.Message, "gvElectrode_RowCancelingEdit");
            }
        }
        #endregion

        #region
        /// <summary>
        /// to edit the existing role
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvElectrode_RowEditing(object sender, GridViewEditEventArgs e)
        {
            try
            {
                gvElectrode.EditIndex = e.NewEditIndex;
                bindElectrodeDesign();
            }
            catch (Exception ex)
            {
               // ErrorLog.WriteError(ex.Message, "gvElectrode_RowEditing");
            }
        }
        #endregion

        #region
        /// <summary>
        /// updating the existing role with new rolename
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvElectrode_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
               



              int itemID=int.Parse(gvElectrode.DataKeys[gvElectrode.EditIndex].Value.ToString());

                 SPListItemCollection slcollElectrode = slElectrodeDesign.Items;
                SPListItem slitemElectrode = slcollElectrode.GetItemById(itemID);
                if (Page.IsValid)
                {
                    EntityList<DesignDocumentDocument> entAttachments = dt.GetList<DesignDocumentDocument>("DesignDocument");
                    TextBox txtNotes2dE = (TextBox)gvElectrode.Rows[e.RowIndex].FindControl("txtNotes2dE");
                    TextBox txtNotes3dE = (TextBox)gvElectrode.Rows[e.RowIndex].FindControl("txtNotes3dE");
                    FileUpload fu3dElectrode = (FileUpload)gvElectrode.Rows[e.RowIndex].FindControl("fu3dElectrode");
                    FileUpload fu2dElectrode = (FileUpload)gvElectrode.Rows[e.RowIndex].FindControl("fu2dElectrode");



                    HiddenField hdf3dCon = (HiddenField)gvElectrode.Rows[e.RowIndex].FindControl("hdf3dCon");



                    HiddenField hdf2dCon = (HiddenField)gvElectrode.Rows[e.RowIndex].FindControl("hdf2dCon");
                    slitemElectrode["Final2DAttachment"] = txtNotes2dE.Text.Trim();
                    slitemElectrode["Final3DAttachment"] = txtNotes3dE.Text.Trim();
                    //Need to discuss what kind of status will be maintained
                    //slitemElectrode["Status"] = "Save";
                   // slitemElectrode["MTFGBOMNO"] = objBusinessEntity.GetLookupValue(objBusinessEntity.MTFGBOM, "MTFGBOMNO", strMTFGBOMNO);
                    slitemElectrode.Update();
                    int intItemID = slitemElectrode.ID;

                    if (fu3dElectrode.PostedFile.FileName != string.Empty)
                    {
                        int intDOC1 = Convert.ToInt32(hdf3dCon.Value);
                        var deletedocument1 = (from en in entAttachments.ToList()
                                               where en.DocID == intDOC1.ToString()
                                               select en).First();
                        entAttachments.DeleteOnSubmit(deletedocument1);
                        dt.SubmitChanges();
                      
                        string file3Dretun = objBusinessEntity.SingleUpload(fu3dElectrode, objBusinessEntity.ElectrodeDesign, "3D_Electrode", intItemID.ToString(), objBusinessEntity.DesignDocument);
                    }
                    if (fu2dElectrode.PostedFile.FileName != string.Empty)
                    {
                        int intDOC2 = Convert.ToInt32(hdf2dCon.Value);
                        var deletedocument1 = (from en in entAttachments.ToList()
                                               where en.DocID == intDOC2.ToString()
                                               select en).First();
                        entAttachments.DeleteOnSubmit(deletedocument1);
                        dt.SubmitChanges();
                        string file2Dretun = objBusinessEntity.SingleUpload(fu2dElectrode, objBusinessEntity.ElectrodeDesign, "2D_Electrode", intItemID.ToString(), objBusinessEntity.DesignDocument);
                    }

                   // bindElectrodeDesign();

                }
            }
            catch (Exception ex)
            {
              //  ErrorLog.WriteError(ex.Message, "gvElectrode_RowUpdating");
            }
            finally
            {
               gvElectrode.EditIndex = -1;
               bindElectrodeDesign();
            }
        }
        #endregion

        #region
        /// <summary>
        /// page changing events for gridview control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvElectrode_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            try
            {
                gvElectrode.EditIndex = -1;
                gvElectrode.PageIndex = e.NewPageIndex;
                bindElectrodeDesign();
            }
            catch (Exception ex)
            {
               // ErrorLog.WriteError(ex.Message, "gvElectrode_PageIndexChanging");
            }
        }
        #endregion


        protected void gvElectrode_Rowcommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                LinkButton lnkbtnNew = e.CommandSource as LinkButton;
                GridViewRow gvrROW = lnkbtnNew.NamingContainer as GridViewRow;
                Label lblData3D = (Label)gvrROW.FindControl("lblData3D");
                FileUpload fu3dElectrode = (FileUpload)gvrROW.FindControl("fu3dElectrode");
                LinkButton lnkbut3DCon = (LinkButton)gvrROW.FindControl("lnkbut3DCon");
                HiddenField hdf3dCon = (HiddenField)gvrROW.FindControl("hdf3dCon");
                Label lblData2D = (Label)gvrROW.FindControl("lblData2D");
                FileUpload fu2dElectrode = (FileUpload)gvrROW.FindControl("fu2dElectrode");
                LinkButton lnkbut2DCon = (LinkButton)gvrROW.FindControl("lnkbut2DCon");
                HiddenField hdf2dCon = (HiddenField)gvrROW.FindControl("hdf2dCon");
                RequiredFieldValidator rfv3d = (RequiredFieldValidator)gvrROW.FindControl("rfv3d");
                RequiredFieldValidator rfv2d = (RequiredFieldValidator)gvrROW.FindControl("rfv2d");



                EntityList<DesignDocumentDocument> entAttachments = dt.GetList<DesignDocumentDocument>("DesignDocument");
                if (e.CommandName == "delete2D")
                {
                    int intDOC1 = Convert.ToInt32(hdf2dCon.Value);
                    var deletedocument1 = (from en in entAttachments.ToList()
                                           where en.DocID == intDOC1.ToString()
                                           select en).First();
                    entAttachments.DeleteOnSubmit(deletedocument1);
                    lblData2D.Visible = false;
                    lnkbut2DCon.Visible = false;
                    fu2dElectrode.Visible = true;
                    rfv2d.ValidationGroup = "validateEdit";
                }
                if (e.CommandName == "delete3D")
                {
                    int intDOC2 = Convert.ToInt32(hdf3dCon.Value);
                    var deletedocument2 = (from en in entAttachments.ToList()
                                           where en.DocID == intDOC2.ToString()
                                           select en).First();
                    entAttachments.DeleteOnSubmit(deletedocument2);
                    lblData3D.Visible = false;
                    lnkbut3DCon.Visible = false;
                    fu3dElectrode.Visible = true;
                    rfv3d.ValidationGroup = "validateEdit";
                }

                dt.SubmitChanges();


            }

            catch (Exception ex)
            {
                objBusinessEntity.ErrorLog(ex.Message + ex.StackTrace);
            }
        }
        #region
        /// <summary>
        /// binding the status radion button list to the gridview control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvElectrode_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                //if ((e.Row.RowType == DataControlRowType.DataRow))
                //{
                //    RadioButtonList rbnStatus = (RadioButtonList)e.Row.FindControl("rbnStatus");
                //    Label lblStatus = (Label)e.Row.FindControl("lblStatus");
                //    if (lblStatus.Text == "True")
                //    {
                //        if (rbnStatus != null)
                //        {
                //            rbnStatus.SelectedValue = "1";
                //        }
                //        else
                //        {
                //            lblStatus.Text = "Active";
                //        }
                //    }
                //    else
                //    {
                //        if (rbnStatus != null)
                //        {
                //            rbnStatus.SelectedValue = "0";
                //        }
                //        else
                //        {
                //            lblStatus.Text = "In Active";
                //        }
                //    }
                //}
            }
            catch (Exception ex)
            {
               // ErrorLog.WriteError(ex.Message, "gvElectrode_RowDataBound");
            }
        }
        #endregion


        #endregion
        #region Bind Grid
        protected void bindElectrodeDesign()
        {
            try
            {
                var linqelctrode = from elct in entElectrode.ToList()
                                   where elct.MTFGBOMNO.MTFGBOMNO == strMTFGBOMNO
                                   select elct;
                dtElectrode.Columns.Add(new DataColumn("ElectrodeID", typeof(string)));
                dtElectrode.Columns.Add(new DataColumn("FilePath3d", typeof(string)));
                dtElectrode.Columns.Add(new DataColumn("3DElectrode", typeof(string)));
                dtElectrode.Columns.Add(new DataColumn("URL", typeof(string)));
                dtElectrode.Columns.Add(new DataColumn("DocuementID3d", typeof(string)));
                dtElectrode.Columns.Add(new DataColumn("3DFinalNotes", typeof(string)));
                dtElectrode.Columns.Add(new DataColumn("FilePath2d", typeof(string)));
                dtElectrode.Columns.Add(new DataColumn("2DElectrode", typeof(string)));
                dtElectrode.Columns.Add(new DataColumn("DocuementID2d", typeof(string)));
                dtElectrode.Columns.Add(new DataColumn("2DFinalNotes", typeof(string)));
                if (linqelctrode.Count() == 0)
                {
                  


                    dtElectrode.Rows.Add(dtElectrode.NewRow());

                    gvElectrode.DataSource = dtElectrode;
                    gvElectrode.DataBind();
                    gvElectrode.FooterRow.Visible = true;
                    gvElectrode.Rows[0].Visible = false;
                }
                else
                {

                    



                    for (int i = 0; i < linqelctrode.Count(); i++)
                    {
                        int intItemID = Convert.ToInt32(linqelctrode.ToList()[i].Id);

                        var linq2dattach = from att1 in entdoc.ToList().Where(att => att.ItemID == intItemID.ToString() && att.ListName == slElectrodeDesign.Title && att.ColumnName == str2Dattachment)
                                         select att1;
                        var linq3dattach = from att2 in entdoc.ToList().Where(att => att.ItemID == intItemID.ToString() && att.ListName == slElectrodeDesign.Title && att.ColumnName == str3Dattachment)
                                         select att2;
                        DataRow drow = dtElectrode.NewRow();
                        drow["ElectrodeID"] = linqelctrode.ToList()[i].Id;
                        drow["2DFinalNotes"] = linqelctrode.ToList()[i].Final2DAttachment;
                        drow["3DFinalNotes"] = linqelctrode.ToList()[i].Final3DAttachment;
                        drow["URL"] = SPContext.Current.Web.Url;

                        if (linq2dattach.Count() != 0)
                        {
                            drow["2DElectrode"] = linq2dattach.ToList()[0].Name;
                            drow["FilePath2d"] = linq2dattach.ToList()[0].Path + "/" + linq2dattach.ToList()[0].Name;
                            drow["DocuementID2d"] = linq2dattach.ToList()[0].DocID;
                        }
                        else
                        {
                            drow["DocuementID2d"] = "";
                        }
                        if (linq3dattach.Count() != 0)
                        {
                            drow["3DElectrode"] = linq3dattach.ToList()[0].Name;
                            drow["FilePath3d"] = linq3dattach.ToList()[0].Path + "/" + linq3dattach.ToList()[0].Name; ;
                            drow["DocuementID3d"] = linq3dattach.ToList()[0].DocID;
                        }
                        else
                        {
                            drow["DocuementID3d"] = "N/A";
                        }
                    


                        dtElectrode.Rows.Add(drow);

                    }

                 
                    //var linqattach=from doc in entdesigndoc.ToList().Where(doc=>

                    gvElectrode.DataSource = dtElectrode;
                    gvElectrode.DataBind();

                }

            }
            catch (Exception ex)
            {
                objBusinessEntity.ErrorLog(ex.Message + ex.StackTrace+ "bindElectrodeDesign");
            }
        }

        #endregion

No comments:

Post a Comment