1
Answer

Add rotator

pradeep

pradeep

16y
2.8k
1
Hi,i have used addrotator in which the XML file fills images dynamically.
the problem is when the image is changed at certain interval of time,the page jumps from midpage to bottom.i mean scroll bar will come down automatically,when tried to move up,it will come down again.

Can i get the solution for this.
Answers (1)
0
Senthilkumar

Senthilkumar

NA 15.2k 2.4m 12y
Hi,

As per as my knowledge is concerned, yes you are right! you need to store in any one of them...

Accepted
0
Ilkin East

Ilkin East

NA 100 126.9k 12y
Thank You Senthilkumar!!

Everything is ok.What if we try to do it in windows application.I need to store it anyware.In a file,xml,database?

Thanks .

 
0
Senthilkumar

Senthilkumar

NA 15.2k 2.4m 12y
Hi,

The reason is i think you have not stored the data some where and need to add from the stored data.

I have done the example page. You can change the field name or design.

Design page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddRows.aspx.cs" Inherits="Corner_AddRows" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tr>
                <td style="text-align: right">
                    Enter the First Name:
                </td>
                <td>
                    <asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td style="text-align: right">
                    Enter the Last Name:
                </td>
                <td>
                    <asp:TextBox ID="txtLastName" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center">
                    <asp:Button ID="btnAdd" runat="server" Text="Add" onclick="btnAdd_Click" />
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center">
                    <asp:GridView ID="gvList" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None"
                        Width="544px">
                        <RowStyle BackColor="#EFF3FB" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>


Code File:

   protected void Page_Load(object sender, EventArgs e)
    {
        
        if (Session["UsersTable"] != null)
        {
            DataTable dt = (DataTable)Session["UsersTable"];
        }
        
    }
    
    private void BindTable(DataTable dt)
    {
        gvList.DataSource = dt;
        gvList.DataBind();
        Session["UsersTable"] = dt;
    }

    protected void btnAdd_Click(object sender, EventArgs e)
    {
        DataTable dtCurrent = null;

        if (Session["UsersTable"] != null)
        {
            dtCurrent = (DataTable)Session["UsersTable"];
        }
        else
        {
            dtCurrent = CreateTable();
        }

        DataRow dRow = dtCurrent.NewRow();
        dRow["FName"] = txtFirstName.Text.Trim();
        dRow["LName"] = txtLastName.Text.Trim();
        dtCurrent.Rows.Add(dRow);
        BindTable(dtCurrent);

    }

    private DataTable CreateTable()
    {
        DataTable dtable = new DataTable();
        DataColumn dColumn = null;
        DataRow dRow = null;

        dColumn = new DataColumn();
        dColumn.ColumnName = "FName";
        dtable.Columns.Add(dColumn);

        dColumn = new DataColumn();
        dColumn.ColumnName = "LName";
        dtable.Columns.Add(dColumn);

        return dtable;
    }

Hope this will help you.