Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8831821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:23:48+00:00 2026-06-14T08:23:48+00:00

<asp:Panel ID=pnlGrdShift runat=server ScrollBars=Auto Width=900px Height=520px CssClass=srcColor> <cc1:GridView ID=gvShift runat=server AutoGenerateColumns=False AllowSorting=True CssClass=grid OnDataBound=gvShift_DataBound

  • 0
<asp:Panel ID="pnlGrdShift" runat="server" ScrollBars="Auto" Width="900px" Height="520px" CssClass="srcColor">
            <cc1:GridView  ID="gvShift" runat="server" AutoGenerateColumns="False" AllowSorting="True"
               CssClass="grid"
               OnDataBound="gvShift_DataBound" 
               DataSourceID="odsShiftDetails" 
               AllowPaging="True" 
               ShowFooter="false"
               onrowcancelingedit="gvShift_RowCancelingEdit" 
               onrowcommand="gvShift_RowCommand" 
               onrowdeleting="gvShift_RowDeleting" 
               onrowediting="gvShift_RowEditing" 
               onrowupdating="gvShift_RowUpdating" 
               OnSelectedIndexChanged="gvShift_SelectedIndexChanged" 
               OnRowDataBound="gvShift_RowDataBound">        
                <AlternatingRowStyle CssClass="altrowstyle"  />
                <HeaderStyle CssClass="headerstyle" />
                <RowStyle CssClass="rowstyle" Wrap="false"  />
                <EmptyDataRowStyle BackColor="#edf5ff" Height="300px" VerticalAlign="Middle" HorizontalAlign="Center" />
                <EmptyDataTemplate >
                    No Records Found
                </EmptyDataTemplate> 
                <Columns>
                    <asp:TemplateField HeaderText="E Code" SortExpression="userecode" HeaderStyle-Font-Bold="true" HeaderStyle-Font-Names="Calibre" HeaderStyle-ForeColor="White">
                        <ItemTemplate>
                            <asp:Label ID="lblUserECode" runat="server" Text='<%#Eval("userecode") %>' CssClass="GridContent" />                    
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label ID="lblEditUserECode" runat="server" Text='<%#Eval("userecode") %>' style="width:50px;" CssClass="GridContent" />                    
                        </EditItemTemplate>
                    </asp:TemplateField>                       

                    <asp:TemplateField HeaderText="User Name" SortExpression="username" HeaderStyle-Font-Bold="true" HeaderStyle-Font-Names="Calibre" HeaderStyle-ForeColor="White">
                        <ItemTemplate>
                            <asp:Label ID="lblUserName" runat="server" Text='<%#Eval("username") %>' CssClass="GridContent" />                    
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label ID="lblEditUserName" runat="server" Text='<%#Eval("username") %>' style="width:100px;" CssClass="GridContent"/>                    
                        </EditItemTemplate>
                    </asp:TemplateField>


                    <asp:TemplateField HeaderText="Shift Start Time" SortExpression="ShiftStartTime" HeaderStyle-Font-Bold="true" HeaderStyle-Font-Names="Calibre" HeaderStyle-ForeColor="White">
                         <ItemTemplate>
                            <asp:Label ID="lblShiftStartTime" runat="server" Text='<%#Eval("ShiftStartTime") %>'  CssClass="GridContent"/>                    
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="ddlShiftStartTime" runat="server" Text='<%#Eval("ShiftStartTime") %>' style="width:65px;" CssClass="GridContent" />
                            <asp:RegularExpressionValidator ID="RegularExpValidatorddlShiftStartTime" runat="server" ControlToValidate="ddlShiftStartTime" ValidationExpression="^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$" ErrorMessage="*" Font-Bold="true" ForeColor="Red" ToolTip="Must be in HH:MM" />                            

                        </EditItemTemplate>                            
                    </asp:TemplateField>  

                    <asp:TemplateField HeaderText="Shift End Time" SortExpression="ShiftEndTime" HeaderStyle-Font-Bold="true" HeaderStyle-Font-Names="Calibre" HeaderStyle-ForeColor="White">
                        <ItemTemplate>
                            <asp:Label ID="lblShiftEndTime" runat="server" Text='<%#Eval("ShiftEndTime") %>' CssClass="GridContent" />                    
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="ddlShiftEndTime" runat="server" Text='<%#Eval("ShiftEndTime") %>' style="width:65px;" CssClass="GridContent"  />
                            <asp:RegularExpressionValidator ID="RegularExpValidatorddlShiftEndTime" runat="server" ControlToValidate="ddlShiftEndTime" ValidationExpression="^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$" ErrorMessage="*" Font-Bold="true" ForeColor="Red" ToolTip="Must be in HH:MM" />                            

                        </EditItemTemplate>                            
                    </asp:TemplateField>
                        <%--<asp:BoundField DataField="ShiftEndTIme" HeaderText="Shift End Time" SortExpression="ShiftEndTIme"/>--%>
                    <asp:TemplateField HeaderText="Saturday Shift Start Time" SortExpression="WeekendShiftStartTime" HeaderStyle-Font-Bold="true" HeaderStyle-Font-Names="Calibre" HeaderStyle-ForeColor="White">
                        <ItemTemplate>
                            <asp:Label ID="lblWeekendShiftStartTime" runat="server" Text='<%#Eval("WeekendShiftStartTime") %>' CssClass="GridContent" />                    
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="ddlWeekendShiftStartTime" runat="server" Text='<%#Eval("WeekendShiftStartTime") %>' style="width:65px;" CssClass="GridContent" />  
                            <asp:RegularExpressionValidator ID="RegularExpValidatorddlWeekendShiftStartTime" runat="server" ControlToValidate="ddlWeekendShiftStartTime" ValidationExpression="^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$" ErrorMessage="*" Font-Bold="true" ForeColor="Red" ToolTip="Must be in HH:MM" />                          

                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Saturday Shift End Time" SortExpression="weekendshiftendtime" HeaderStyle-Font-Bold="true" HeaderStyle-Font-Names="Calibre" HeaderStyle-ForeColor="White">
                    <ItemTemplate>
                            <asp:Label ID="lblWeekendShiftEndTime" runat="server" Text='<%#Eval("weekendshiftendtime") %>' CssClass="GridContent"/>                    
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="ddlWeekendShiftEndTime" runat="server" Text='<%#Eval("weekendshiftendtime") %>' style="width:65px;" CssClass="GridContent" /> 
                            <asp:RegularExpressionValidator ID="RegularExpValidatorddlWeekendShiftEndTime" runat="server" ControlToValidate="ddlWeekendShiftEndTime" ValidationExpression="^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$" ErrorMessage="*" Font-Bold="true" ForeColor="Red" ToolTip="Must be in HH:MM" />                           

                        </EditItemTemplate>                           
                    </asp:TemplateField>

                    <asp:TemplateField  ShowHeader="False" > 
                        <EditItemTemplate> 
                          <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update" ForeColor="White"></asp:LinkButton> 
                          <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" ForeColor="White"></asp:LinkButton> 
                        </EditItemTemplate> 
                        <ItemTemplate> 
                          <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" ForeColor="White"></asp:LinkButton> 
                        </ItemTemplate> 
                </asp:TemplateField>                    
           </Columns>
                <PagerTemplate >
                     <table width="100%" >
                        <tr>
                            <td style="text-align:  left">
                                Page Size: 
                                    <asp:DropDownList ID="ddPageSize" runat="server" EnableViewState="true" OnSelectedIndexChanged="ddPageSize_SelectedIndexChanged" AutoPostBack="true" style="width:50px;">
                                    <asp:ListItem Text="10" ></asp:ListItem>
                                    <asp:ListItem Text="20" ></asp:ListItem>
                                    <asp:ListItem Text="30" ></asp:ListItem>
                                    <asp:ListItem Text="40" ></asp:ListItem>
                                    <asp:ListItem Text="50" ></asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td style="text-align: right">
                                <asp:Label ID="lblPageCount" runat="server"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </PagerTemplate>
                </cc1:GridView>      
         </asp:Panel></td></tr>
                </table>
                                                       <div style="margin-top:5px" class="PagerGrid">
                <asp:DataPager  ID="pager" runat="server" PagedControlID="gvShift">
                    <Fields>                                            
                        <asp:NextPreviousPagerField FirstPageText="&lt;&lt;" LastPageText="&gt;&gt;" 
                            NextPageText="&gt;"  PreviousPageText="&lt;" ShowFirstPageButton="True"
                            ShowNextPageButton="False" ButtonCssClass="datapager"  />
                        <asp:NumericPagerField ButtonCount="10"  NumericButtonCssClass="datapager" CurrentPageLabelCssClass="datapager"   />
                        <asp:NextPreviousPagerField LastPageText="&gt;&gt;" NextPageText="&gt;" 
                            ShowLastPageButton="True" ShowPreviousPageButton="False" ButtonCssClass="datapager" />
                    </Fields>
                </asp:DataPager>
            </div>
            <br />
            <asp:ObjectDataSource ID="odsShiftDetails" runat="server" 
                SelectMethod="GetShiftInfoSortedPage" TypeName="EQ.DAL.ShiftInfoDB"
                EnablePaging="True" SelectCountMethod="GetShiftInfoCount" 
                SortParameterName="sortExpression">
                <SelectParameters>
                    <asp:ControlParameter  ControlID="hfSearchCriteria"  Name="searchCriteria" Direction="Input"  />
                </SelectParameters>                                            
            </asp:ObjectDataSource>

Code behind for Row Updation is:-

protected void gvShift_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            TextBox txtShiftStartTime = (TextBox)gvShift.Rows[e.RowIndex].FindControl("ddlShiftStartTime");
            TextBox txtShiftEndTime = (TextBox)gvShift.Rows[e.RowIndex].FindControl("ddlShiftEndTime");
            TextBox txtWeekendShiftStartTime = (TextBox)gvShift.Rows[e.RowIndex].FindControl("ddlWeekendShiftStartTime");
            TextBox txtWeekendShiftEndTime = (TextBox)gvShift.Rows[e.RowIndex].FindControl("ddlWeekendShiftEndTime");
            Label lblUserecode = (Label)gvShift.Rows[e.RowIndex].FindControl("lblEditUserECode");

            string userecode = lblUserecode.Text.ToString();
            string _ShiftStart = txtShiftStartTime.Text.ToString();
            string _ShiftEnd = txtShiftEndTime.Text.ToString();
            string _WeekendShiftStart = txtWeekendShiftStartTime.Text.ToString();
            string _WeekendShiftend = txtWeekendShiftEndTime.Text.ToString();

            EmployeeQuotientCL.Entities.ConfigurationVariables _configVariables = new ConfigurationVariables();
            string databaseConnectionString = _configVariables.ConnectionString;
            SqlConnection sqlConnection = null;
            if (((databaseConnectionString + string.Empty) != string.Empty))
            {
                DBConnect dbConnect = new DBConnect(_configVariables.ConnectionString);
                sqlConnection = dbConnect.SQLConnection;
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = sqlConnection;
                cmd.CommandText = "UPDATE UserInfo SET ShiftStartTime ='" + _ShiftStart + "',ShiftEndTime='" + _ShiftEnd.ToString() + "',Weekendshiftstarttime='" + _WeekendShiftStart.ToString() + "',Weekendshiftendtime='" + _WeekendShiftend.ToString() + "'   WHERE UserECode=" + userecode.ToString();
                sqlConnection.Open();
                cmd.ExecuteNonQuery();
                gvShift.DataSource = null;
                gvShift.DataBind();
                sqlConnection.Close();
            }
        }
        catch (Exception ex)
        {
        }
    }

While Updating the Rows in grid , I am getting the below error message.

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: >Updating is not supported by ObjectDataSource ‘odsShiftDetails’ unless the UpdateMethod is >specified.

Guide me how to fix this error. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:23:49+00:00Added an answer on June 14, 2026 at 8:23 am

    You need to add an update method to your gridview. Look at this tutorial: Gridview ObjectdataSource

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<asp:Panel ID=Panel2 runat=server Height=469px Width=152px> </asp:Panel> <asp:Panel ID=Panel1 runat=server BackColor=#666666 Height=363px Width=533px> </asp:Panel> Hey
<asp:table runat=server ID=mainTable Width=100% Height=100% BorderColor=Red BorderWidth=20px BorderStyle=Solid> <asp:TableRow runat=server ID=mainRow Width=100% Height=100% BorderColor=Purple
I have a datalist inside the panel <asp:Panel ID=Panel1 runat=server ScrollBars=Vertical> <asp:DataList ID=DataList1 runat=server
Hi I have created user control for re-sizable text box. <asp:Panel ID=PanelText runat=server CssClass=frameText>
I have my menu: <asp:Panel runat=server CssClass=menuLink ID=mnuMyJobs> <a href=../jobs/index.asp>My Jobs</a> </asp:Panel> <asp:Panel runat=server
I have the following panel <asp:Panel ID=pnlSessionController runat=server style=position: relative; display: block; padding:15px; height:
I have my GridView populating like so: <asp:Panel ID=pnlGrid runat=server> <div class=m_container style=margin-bottom:20px;> <asp:GridView
I have this panel... <asp:Panel ID=panSumarios runat=server style=border:0px solid red;width:100% ViewStateMode=Enabled></asp:Panel> ...inside a div
<asp:Panel ID=CreateGroupPanel runat=server CssClass=style10 Visible=True > <asp:ToolkitScriptManager ID=ToolkitScriptManager1 runat=server> </asp:ToolkitScriptManager> <asp:UpdatePanel ID=UpdatePanel1 runat=server> ....
I have a custom UserControl which uses a simple ITemplate: <asp:Panel runat=server ID=pnlExpander CssClass=expander>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.