Navigating records in web form

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Navigating records in web form

    Dear Sir
    I biging in asp.net and i want desine a data entry form
    with single record at time. i need navigate records but i
    dont now.
    Plese help me , how can i do this.

    Thanks for your time.

    H.CHE

    Hassan Cheraghali Guest

  2. Similar Questions and Discussions

    1. Navigating Between Detail Records
      Does anyone know of a way that I can navigate records from a search query from a details window? Let me explain. I have a search utility where the...
    2. navigating through records
      Using asp/ado/IE: Let say I have a recordset contianing 1000 records. I don't want to show *all* 1000 records in one long table on a page so how do...
    3. Navigating through records in a subform
      I am trying to add some record navigation buttons using a command button. For example, in the command button wizard, i choose the "go to next...
    4. New Records from Form
      I have a form to enter a School Name and a Date and when I click a button on this form it opens another form with attendance data to be edited. I...
    5. new records will not show up in form
      I have created a form using a query and I want to add new records, and I want them to show up in the form. However, when I add new records they...
  3. #2

    Default Re: Navigating records in web form

    Take a look @ [url]http://www.aspfree.com/examples/504,1/examples.aspx[/url]

    or You can try out
    <p align ="center">
    <asp:DataGrid id="DataGrid1" runat="server" BorderColor="#E7E7FF"
    AllowPaging="True" OnPageIndexChanged="PageRecords" PageSize=<%#intPageSize%>
    BorderWidth="1px" BackColor="White" CellPadding="3"
    GridLines="Horizontal" BorderStyle="None" Font-Names="Verdana"
    Font-Size="X-Small" Width="50%" ItemStyle-Width="25%">
    <SelectedItemStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#738A9C"></SelectedItemStyle>
    <AlternatingItemStyle BackColor="#F7F7F7"></AlternatingItemStyle>
    <ItemStyle ForeColor="#4A3C8C" BackColor="#E7E7FF"></ItemStyle>
    <HeaderStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#4A3C8C"></HeaderStyle>
    <FooterStyle ForeColor="#4A3C8C" BackColor="#B5C7DE"></FooterStyle>
    <PagerStyle Visible="true" HorizontalAlign="Right" ForeColor="#4A3C8C" BackColor="#E7E7FF"
    Mode="NumericPages">
    </PagerStyle>
    </asp:DataGrid>
    </p>
    SqlConnection mycn;
    SqlDataAdapter myda;
    DataSet ds;
    String strConn;
    protected int intPageSize;
    private void Page_Load(object sender, System.EventArgs e)
    {
    // Put user code to initialize the page here

    strConn="Data Source=localhost;uid=sa;pwd=;Initial Catalog=pubs";
    mycn = new SqlConnection(strConn);
    myda = new SqlDataAdapter ("Select * FROM titles", mycn);
    ds= new DataSet ();
    myda.Fill (ds,"Table");
    //The data is displayed as
    //Column1 -> ColumnNames
    //Column2 -> Column Data
    //Hence the intPageSize is set to number of Columns to be Displayed on page
    intPageSize = ds.Tables [0].Columns.Count;

    //GoDoReshape(ds)-> Function: To display the data vertically
    DataGrid1.DataSource=GoDoReShape(ds);
    if (!Page.IsPostBack )
    {
    DataGrid1.DataBind ();
    }
    }

    public DataSet GoDoReShape(DataSet ds)
    {
    DataSet NewDs=new DataSet();

    NewDs.Tables.Add();
    //Create Two Columns with names "ColumnName" and "Value"
    //ColumnName -> Displays all ColumnNames
    //Value -> Displays ColumnData
    NewDs.Tables[0].Columns.Add("ColumnName");
    NewDs.Tables[0].Columns.Add("Value");

    foreach(DataRow dr in ds.Tables [0].Rows )
    {
    foreach(System.Data.DataColumn dcol in ds.Tables[0].Columns)
    {
    //Declare Array
    string[] MyArray={dcol.ColumnName.ToString(),dr[dcol.ColumnName.ToString()].ToString()};
    NewDs.Tables[0].Rows.Add(MyArray);
    }
    }
    return NewDs;
    }
    protected void PageRecords(object source,
    System.Web.UI.WebControls.DataGridPageChangedEvent Args e)
    {
    DataGrid1.CurrentPageIndex = e.NewPageIndex;
    DataGrid1.DataBind();
    }

    HTH
    Regards
    Sushila
    ..NET MVP

    "Hassan Cheraghali" <che_rayaneh@yahoo.com> wrote in message news:04cd01c349d6$3e99ed50$a501280a@phx.gbl...
    > Dear Sir
    > I biging in asp.net and i want desine a data entry form
    > with single record at time. i need navigate records but i
    > dont now.
    > Plese help me , how can i do this.
    >
    > Thanks for your time.
    >
    > H.CHE
    >
    Sonali.NET[MVP] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139