• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

DAtagrid Paging Setting up.

I have the following code:
tbparameters
    CM_REF PM_NAME            PM_TYPE PM_DIRECTION  PM_LENGTH PM_CONTENT                                           PM_INDEX PM_DESCRIPTION
---------- --------------- ---------- ------------ ---------- -------------------------------------------------- ---------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
         1 pm_ServNb                8            1          8                                                             1 Input service number
         2 pm_AccNB                 8            1         12                                                             1 Input account number
         3 pm_LastName              8            1         50                                                             1 Input last name
         5 pm_Username              8            1         32                                                             1 Username field
         4 pm_FirstName             8            1         50                                                             1 Input first name
         5 pm_Password              8            1         40                                                             2 Password field
         6 pm_PaymNb                8            1         10                                                             1 Payment number field
         6 pm_CashNb                8            1          8                                                             2 Cashier number field
         6 pm_Date                  8            1         19                                                             3 Receipt date field
         6 pm_Data                  8            1       2500                                                             4 Receipt data
         7 pm_PaymNb                8            1         10                                                             1 Payment number field for tbreceipts



I am missing something. It basically does not tell me there is no page 2. I cannot figure the problem out.

<%@ Register TagPrefix="uc1" TagName="logout" Src="Engine/Controls/logout.ascx" %>
<%@ import namespace="System.Web.UI" %>
<%@ import namespace="System.Web.SessionState" %>
<%@ import namespace="System.Web" %>
<%@ import namespace="System.Drawing" %>
<%@ import namespace="System.ComponentModel" %>
<%@ import namespace="System.Collections" %>
<%@ import namespace="System.Text" %>
<%@ import namespace="System.Data" %>
<%@ Import Namespace="System.Data.Odbc" %>
<%@ Register TagPrefix="mspos" TagName="header" Src="Engine/Controls/header.ascx" %>
<%@ Register TagPrefix="mspos" TagName="footer" Src="~/Engine/Controls/footer.ascx" %>
<HTML>
<HEAD>
<title>Users Interface to Managing Adminitrators</title>
<meta content="True" name="vs_snapToGrid">
<script language="C#" runat="server">
private DataSet ddlDataSet = new DataSet();
private OdbcConnection myConnection =  new OdbcConnection("DSN=MSPOS;UID=system;PWD=system");
private DataSet ddlDataSet1 = new DataSet();
private DataSet ddlDataSet2 = new DataSet();
private string CommandID;            



//*********************************************************************
// Get TBDATATYPE and populate dataset with DT_REF and DT_DESCRIPTION  
public DataSet BindTBDATATYPE()
{
            OdbcConnection myConnection =  new OdbcConnection("DSN=MSPOS;UID=system;PWD=system");

            // Populate the ddlDataSet1
            myConnection.Open();
            const string strSQLDDL = @"SELECT DT_REF, DT_DESCRIPTION FROM TBDATATYPE ORDER BY DT_REF";
            OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
            ddlDataSet1.Clear();  
            myDataAdapter.Fill(ddlDataSet1, "ddlDATATYPE");
            myDataAdapter.Dispose();
            myDataAdapter = null;
            myConnection.Close();
            return ddlDataSet1;
}
//***********************************************************************



//***********************************************************************
// Get TBPARAMDIRECTION and populate dataset with PD_REF and PD_DESCRIPTION
public DataSet BindTBPARAMDIRECTION()
{
            OdbcConnection myConnection =  new OdbcConnection("DSN=MSPOS;UID=system;PWD=system");

            // Populate the ddlDataSet2
            myConnection.Open();
            const string strSQLDDL = @"SELECT PD_REF, PD_DESCRIPTION FROM TBPARAMDIRECTION ORDER BY PD_REF";
            OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
            ddlDataSet2.Clear();  
            myDataAdapter.Fill(ddlDataSet2, "ddlPARAMDIRECTION");
            myDataAdapter.Dispose();
            myDataAdapter = null;
            myConnection.Close();
            return ddlDataSet2;
}
//***********************************************************************


 
//****************************************************************
protected void Page_Load(object sender, System.EventArgs e)
{
      if (!Page.IsPostBack)
      {
            BindData();
      }
}
//****************************************************************



//****************************************************************
private void BindData()
{
      OdbcConnection myConnection =  new OdbcConnection("DSN=MSPOS;UID=system;PWD=system");
    myConnection.Open();
         
    // get records from the table
    string commandString = @"SELECT GET_DT_TBDATATYPE(PM_TYPE) AS TYPENAME, GET_PD_TBPARAMDIRECTION(PM_DIRECTION) AS DIRECTIONNAME, CM_REF, PM_INDEX, PM_NAME, PM_DESCRIPTION, PM_TYPE AS DT_REF, PM_CONTENT, PM_DIRECTION AS PD_REF, PM_LENGTH  FROM TBPARAMETERS ORDER BY CM_REF";      
      // Set the datagrid's datasource to the datareader and databind
    // Create a OdbcCommand object and assign the connection connect to the database
    OdbcCommand command = myConnection.CreateCommand( );
    command.CommandText = commandString;
    command.Connection = myConnection;
      // Create the Reader and bind it to the datagrid
    OdbcDataReader reader =  command.ExecuteReader(CommandBehavior.CloseConnection);
    DataGridUserManagementID.DataSource=reader;
    DataGridUserManagementID.DataBind();
      reader.Close();
      reader=null;
    myConnection.Dispose();
      myConnection.Close();
          
}
//****************************************************************


//************************************************************
private void DataGridUserManagementID_SelectedIndexChanged(object sender, System.EventArgs e)
{
      int intCount;
      for (intCount = 1; intCount <= DataGridUserManagementID.Items.Count; intCount ++)
          DataGridUserManagementID.Items[intCount - 1].BorderStyle =  BorderStyle.Groove;

      DataGridUserManagementID.SelectedItem.BorderStyle = BorderStyle.Dashed;
}
//************************************************************



//****************************************************************
private void DataGridUserManagementID_Delete(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
   
  // Get the CommandID of the row whose Delete button was clicked
   string strCommandID = ((Label)e.Item.FindControl("lblCommandID")).Text;
   int SelectedCommandID = Convert.ToInt32(strCommandID);
   string strSQL = "Delete from TBPARAMETERS where CM_REF ='"+ SelectedCommandID +"'";
   ExecuteQuery(strSQL);
     
   DataGridUserManagementID.EditItemIndex = -1;
   BindData();
}
//****************************************************************



//***************************************************************
private int ExecuteQuery(string sqlCmd)
{
   // Create a OdbcCommand object and assign the connection connect to the database
   OdbcConnection myConnection =  new OdbcConnection("DSN=MSPOS;UID=system;PWD=system");
   myConnection.Open();
   OdbcCommand command = myConnection.CreateCommand( );
   command.CommandText = sqlCmd;
   command.Connection = myConnection;
   return command.ExecuteNonQuery();
}
//***************************************************************



//***************************************************************
private void DataGridUserManagementID_Update(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
    // Determine what store was selected
    string strTypeID, strType, strDirectionID, strDirection;
    string cmd;
      string CommandID, strCommandID, strDescription, strName, strTimeout, strContent, strLength;    
    ///... declarations for remaining data fields
    CommandID = Session["CommandID"].ToString();
      strCommandID = ((TextBox)e.Item.FindControl("editCommandID")).Text;
    strDescription = ((TextBox)e.Item.FindControl("editDescription")).Text;
    strName = ((TextBox)e.Item.FindControl("editName")).Text;
      strContent = ((TextBox)e.Item.FindControl("editContent")).Text;
      strLength = ((TextBox)e.Item.FindControl("editLength")).Text;
    strTypeID = ((DropDownList)(e.Item.FindControl("ddlDATATYPE"))).SelectedItem.Value;
        strType = ((DropDownList)(e.Item.FindControl("ddlDATATYPE"))).SelectedItem.Text;
    strDirectionID = ((DropDownList)(e.Item.FindControl("ddlPARAMDIRECTION"))).SelectedItem.Value;
    strDirection = ((DropDownList)(e.Item.FindControl("ddlPARAMDIRECTION"))).SelectedItem.Text;
      
   
      // form the update statement
    // connect to the database
    if (e.CommandName == "Update")    
      {
            string strsql;
            
            if (CommandID != strCommandID)
                  cmd = "Update TBPARAMETERS Set CM_REF='"+ strCommandID +"', PM_NAME ='"+ strName +"', PM_TYPE ='"+ strTypeID +"', PM_DIRECTION = '"+ strDirectionID +"', PM_LENGTH='"+ strLength +"', PM_CONTENT='"+ strTypeID +"', PM_INDEX='"+ strDirectionID +"', PM_DESCRIPTION='"+ strDescription +"' Where CM_REF = "+ CommandID +"";
                else
                     cmd = "Update TBPARAMETERS Set CM_REF='"+ CommandID +"', PM_NAME ='"+ strName +"', PM_TYPE ='"+ strTypeID +"', PM_DIRECTION = '"+ strDirectionID +"', PM_LENGTH='"+ strLength +"', PM_CONTENT='"+ strTypeID +"', PM_INDEX='"+ strDirectionID +"', PM_DESCRIPTION='"+ strDescription +"' Where CM_REF = "+ strCommandID +"";
            
             ExecuteQuery(cmd);
              strsql = null;
              Session["CommandID"] = null;
      }
         DataGridUserManagementID.EditItemIndex = -1;
    BindData(  );
   
}
//************************************************************************




//****************************************************************
private void DataGridUserManagementID_Edit(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
      CommandID = ((Label)e.Item.FindControl("lblCommandID")).Text;
    Session["CommandID"] = CommandID;
      DataGridUserManagementID.EditItemIndex = e.Item.ItemIndex;
    BindData();
}
//****************************************************************



//****************************************************************
private void dg_Page(object source, DataGridPageChangedEventArgs e)
{
      DataGridUserManagementID.CurrentPageIndex = e.NewPageIndex;
    BindData();
}
//****************************************************************




//************************************************************************
protected void DataGridUserManagementID_ItemCreated(Object sender, DataGridItemEventArgs e)
{
      if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem)
      {
            ImageButton btn = (ImageButton)e.Item.FindControl("btnDel");
          btn.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item.')");
      }
}
//************************************************************************


//******************************************************************************
private void DataGridUserManagementID_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
    ListItemType oType = ((ListItemType)e.Item.ItemType);
    if(oType == ListItemType.Item || oType == ListItemType.AlternatingItem)
    {
            e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='lightblue'");            
            e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='Beige'");            
      }
      
      if ((oType == ListItemType.EditItem))
    {
        
        DropDownList listType =((DropDownList)e.Item.FindControl("ddlDATATYPE"));
          listType.SelectedIndex = listType.Items.IndexOf(listType.Items.FindByText(Convert.ToString(DataBinder.Eval(e.Item.DataItem,"TYPENAME"))));
               
          DropDownList listDirection =((DropDownList)e.Item.FindControl("ddlPARAMDIRECTION"));
        listDirection.SelectedIndex = listDirection.Items.IndexOf(listDirection.Items.FindByText(Convert.ToString(DataBinder.Eval(e.Item.DataItem,"PM_DESCRIPTION"))));
      
    }



}
//***************************************************************


//************************************************************************
protected void DataGridUserManagementID_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{

    if (e.CommandName == "Insert")
    {
      // TextBox txtType;
      TextBox txtCommandID, txtParameterIndex, txtName, txtDescription, txtContent, txtLength;
      string strTypeID, strDirectionID;
      txtCommandID = (TextBox)e.Item.FindControl("insertCommandID");
      txtParameterIndex = (TextBox)e.Item.FindControl("insertParameterIndex");
      txtName = (TextBox)e.Item.FindControl("insertName");
      txtDescription = (TextBox)e.Item.FindControl("insertDescription");
      txtContent = (TextBox)e.Item.FindControl("insertContent");
      txtLength = (TextBox)e.Item.FindControl("insertLength");
     
     
      strTypeID = ((DropDownList)(e.Item.FindControl("insertTypes"))).SelectedItem.Value;
      strDirectionID = ((DropDownList)(e.Item.FindControl("insertDirection"))).SelectedItem.Value;
        
        
         // Create the appropriate SQL statement
        StringBuilder strSQL = new StringBuilder("insert into TBPARAMETERS");
        strSQL.Append("(CM_REF, PM_NAME, PM_TYPE, PM_DIRECTION, PM_LENGTH, PM_CONTENT, PM_INDEX, PM_DESCRIPTION)");
        strSQL.Append(" values (");
        strSQL.Append("'").Append(txtCommandID.Text).Append("' ,");
        strSQL.Append("'").Append(txtName.Text).Append("' ,");
        strSQL.Append("'").Append(strTypeID).Append("' ,");
        strSQL.Append("'").Append(strDirectionID).Append("' ,");
        strSQL.Append("'").Append(txtLength.Text).Append("' ,");
        strSQL.Append("'").Append(txtContent.Text).Append("' ,");
        strSQL.Append("'").Append(txtParameterIndex.Text).Append("' ,");
        strSQL.Append("'").Append(txtDescription.Text).Append("' )");
      // call the update and rebind the datagrid
      if ((txtCommandID.Text != "") && (txtName.Text != "") && (txtLength.Text != "") &&
           (txtContent.Text != "") && (txtParameterIndex.Text != "") && (txtDescription.Text != ""))
                     ExecuteQuery(strSQL.ToString());
 
         }
       DataGridUserManagementID.EditItemIndex = -1;
       BindData();
   
}
//************************************************************************


//****************************************************************
private void DataGridUserManagementID_Cancel(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
    DataGridUserManagementID.EditItemIndex = -1;
    BindData();
}
//****************************************************************

public int GetSelectedIndexDATATYPE (string DT_REF)
{  
            int iLoop;
            DataTable dt = ddlDataSet1.Tables["ddlDATATYPE"];
            for (iLoop=0; iLoop < dt.Rows.Count; iLoop++)
            {  
                  string srow = dt.Rows[iLoop]["DT_REF"].ToString();
                  
                  if(srow == DT_REF)
                  {
                        return iLoop;
                  }  
            };  
            return 0;  
 
}

public int GetSelectedIndexPARAMDIRECTION (string PD_REF)
{  
            int iLoop;
            DataTable dt = ddlDataSet2.Tables["ddlPARAMDIRECTION"];
            for (iLoop=0; iLoop < dt.Rows.Count; iLoop++)
            {  
                  string srow = dt.Rows[iLoop]["PD_REF"].ToString();
                        
                  if(srow == PD_REF)
                  {
                        return iLoop;
                  }  
            };  
            return 0;  
 
}

      
            </script>
</HEAD>
<body bgColor="#fef9e9" leftMargin="0" background="images/bg.gif" topMargin="0" marginheigh="0"
            marginwidth="0">
<mspos:header id="header" runat="server"></mspos:header>
<center>
<form id="form1" runat="server">
<TABLE height="380" cellSpacing="0" cellPadding="0" width="100%" border="0" ms_2d_layout="TRUE">
<TR vAlign="top">
<TD>
<!-- Include start of header --------------------------------------------></TD>
<TD></TD>
</TR>
<TR vAlign="top">
<TD></TD>
<TD><asp:datagrid id="DataGridUserManagementID" runat="server" OnDeleteCommand="DataGridUserManagementID_Delete"
                                                OnUpdateCommand="DataGridUserManagementID_Update" OnCancelCommand="DataGridUserManagementID_Cancel"
                                                OnItemDataBound="DataGridUserManagementID_ItemDataBound" OnEditCommand="DataGridUserManagementID_Edit"
                                                OnItemCreated="DataGridUserManagementID_ItemCreated" OnItemCommand="DataGridUserManagementID_ItemCommand"
                                                AllowPaging="True" AllowCustomPaging="True" ShowFooter="True" AutoGenerateColumns="False"
                                                GridLines="None" BorderStyle="Outset" font-size="12px" font-names="arial"
                                                width="449px" PagerStyle-HorizontalAlign="Right" BorderColor="#CCCC99"
                                                BorderWidth="3px" DataKeyField="CM_REF" OnPageIndexChanged="dg_Page">
<FooterStyle Wrap="False" ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
<SelectedItemStyle Font-Bold="True" Wrap="False" HorizontalAlign="Center" ForeColor="#663399" VerticalAlign="Middle"
                                                      BackColor="#FFCC66"></SelectedItemStyle>
<EditItemStyle Wrap="False"></EditItemStyle>
<AlternatingItemStyle Wrap="False" BackColor="PaleGoldenrod"></AlternatingItemStyle>
<ItemStyle Wrap="False" BackColor="Beige"></ItemStyle>
<HeaderStyle Font-Bold="True" Wrap="False" ForeColor="White" BackColor="#954896"></HeaderStyle>
<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="&lt;img src=images/Ok.gif border=0 align=absmiddle alt='Save changes'&gt;"
                                                            CancelText="&lt;img src=images/Cancel.gif border=0 align=absmiddle alt='Cancel editing'&gt;"
                                                            EditText="&lt;img src=images/icn_edit.gif border=0 align=absmiddle alt='Edit this item'&gt;">
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<FooterStyle Wrap="False"></FooterStyle>
</asp:EditCommandColumn>
<asp:TemplateColumn HeaderText="Command ID">
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<asp:Label Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"CM_REF")) %>' Runat="server" ID="lblCommandID">
</asp:Label>
</ItemTemplate>
<FooterStyle Wrap="False"></FooterStyle>
<FooterTemplate>
<asp:TextBox id="insertCommandID" Width="80" runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox Runat="server" ID="editCommandID" Text = '<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"CM_REF")) %>' Width="80">
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Parameter Index">
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<asp:Label Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PM_INDEX")) %>' Runat="server" ID="lblParameterIndex">
</asp:Label>
</ItemTemplate>
<FooterStyle Wrap="False"></FooterStyle>
<FooterTemplate>
<asp:TextBox id="insertParameterIndex" Width="100" runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox Runat="server" ID="editParameterIndex" Text = '<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PM_INDEX")) %>' Width="100">
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Name">
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<asp:Label Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PM_NAME")) %>' Runat="server" ID="lblName">
</asp:Label>
</ItemTemplate>
<FooterStyle Wrap="False"></FooterStyle>
<FooterTemplate>
<asp:TextBox id="insertName" Width="110" runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox Runat="server" ID="editName" Text = '<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PM_NAME")) %>' Width="110">
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Description">
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<asp:Label Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PM_DESCRIPTION")) %>' Runat="server" ID="lblDescription">
</asp:Label>
</ItemTemplate>
<FooterStyle Wrap="False"></FooterStyle>
<FooterTemplate>
<asp:TextBox id="insertDescription" Width="140" runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox Runat="server" ID="editDescription" Text = '<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PM_DESCRIPTION")) %>' Width="140">
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Type">
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<asp:Label id="lblType" Runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"TYPENAME")) %>' >
</asp:Label>
</ItemTemplate>
<FooterStyle Wrap="False"></FooterStyle>
<FooterTemplate>
<asp:DropdownList id="insertTypes" runat="server" DataSource='<%# BindTBDATATYPE() %>' DataValueField="DT_REF" DataTextField="DT_DESCRIPTION">
</asp:DropdownList>
</FooterTemplate>
<EditItemTemplate>
<asp:DropdownList id="ddlDATATYPE" runat="server" DataSource='<%# BindTBDATATYPE() %>' selectedindex='<%# GetSelectedIndexDATATYPE(DataBinder.Eval(Container.DataItem, "TYPENAME").ToString())%>' DataValueField="DT_REF" DataTextField="DT_DESCRIPTION">
</asp:DropdownList>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Content">
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<asp:Label Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PM_CONTENT")) %>' Runat="server" ID="lblContent">
</asp:Label>
</ItemTemplate>
<FooterStyle Wrap="False"></FooterStyle>
<FooterTemplate>
<asp:TextBox id="insertContent" Width="60" runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox Runat="server" ID="editContent" Text = '<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PM_CONTENT")) %>' Width="60">
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Direction">
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<asp:Label id="lblDirection" Runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"DIRECTIONNAME")) %>' >
</asp:Label>
</ItemTemplate>
<FooterStyle Wrap="False"></FooterStyle>
<FooterTemplate>
<asp:DropdownList id="insertDirection" runat="server" DataSource='<%# BindTBPARAMDIRECTION() %>' DataValueField="PD_REF" DataTextField="PD_DESCRIPTION">
</asp:DropdownList>
</FooterTemplate>
<EditItemTemplate>
<asp:DropdownList id="ddlPARAMDIRECTION" runat="server" DataSource='<%# BindTBPARAMDIRECTION() %>' selectedindex='<%# GetSelectedIndexPARAMDIRECTION(DataBinder.Eval(Container.DataItem, "DIRECTIONNAME").ToString())%>' DataValueField="PD_REF" DataTextField="PD_DESCRIPTION">
</asp:DropdownList>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Length">
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<asp:Label Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PM_LENGTH")) %>' Runat="server" ID="lblLength">
</asp:Label>
</ItemTemplate>
<FooterStyle Wrap="False"></FooterStyle>
<FooterTemplate>
<asp:TextBox id="insertLength" Width="50" runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox Runat="server" ID="editLength" Text = '<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PM_LENGTH")) %>' Width="50">
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Delete">
<HeaderStyle Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<asp:ImageButton CommandName="Delete" id="btnDel" runat="server" Runat="server" alt='Delete this item?'
                                                                        ImageUrl="images/icn_del.gif"></asp:ImageButton>
</ItemTemplate>
<FooterStyle Wrap="False"></FooterStyle>
<FooterTemplate>
<asp:ImageButton CommandName="Insert" id="btnAdd" runat="server" alt='Add new item' ImageUrl="images/icn_add.gif"></asp:ImageButton>
</FooterTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle NextPageText="Next&amp;gt;" PrevPageText="&amp;lt; Prev" HorizontalAlign="Center"
                                                      ForeColor="#330099" BackColor="#FFFFCC" Wrap="False" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
<P align="center"><uc1:logout id="Logout1" runat="server"></uc1:logout><BR>
<BR>
<mspos:footer id="footer" runat="server"></mspos:footer></P>
</TD>
<TD height="272"></TD>
</TR>
</TABLE>
</form>
</center> <!-- Include start of footer ------------------------------------------------> <!--------------------------------------------------------------------------->
</body>
</HTML>
0
mathieu_cupryk
Asked:
mathieu_cupryk
1 Solution
 
tusharashahCommented:
Change: AllowCustomPaging="True"
To       : AllowCustomPaging="False"

You're using inbuilt Paging of DataGrid, CustomPaging is different from that.

-tushar
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now