Click here to Skip to main content
15,890,123 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: merging Pin
SeMartens26-Aug-09 21:08
SeMartens26-Aug-09 21:08 
GeneralRe: merging Pin
mylogics26-Aug-09 21:13
professionalmylogics26-Aug-09 21:13 
Questioncode for setting time interval Pin
Jas 00726-Aug-09 20:02
Jas 00726-Aug-09 20:02 
AnswerRe: code for setting time interval Pin
Arun Jacob26-Aug-09 20:18
Arun Jacob26-Aug-09 20:18 
QuestionDisplay Instant Message in site Pin
keyur satyadev26-Aug-09 19:22
keyur satyadev26-Aug-09 19:22 
AnswerRe: Display Instant Message in site Pin
Abhijit Jana26-Aug-09 19:37
professionalAbhijit Jana26-Aug-09 19:37 
GeneralRe: Display Instant Message in site Pin
keyur satyadev26-Aug-09 19:41
keyur satyadev26-Aug-09 19:41 
Questionhow to preserve the variable Pin
swtlibra26-Aug-09 18:44
swtlibra26-Aug-09 18:44 
i have a code for moving to next record
the problem is that
i m using a variable named as rowIndex for increment
and it naviagtes only through two records
i think it refreshes with every postback
so can anyone tell me how to preserve it????

<br />
<br />
public partial class sample : System.Web.UI.Page<br />
{<br />
    OleDbConnection cn;<br />
    OleDbCommand cd;<br />
    OleDbDataReader rd;<br />
    OleDbDataAdapter da;<br />
    int rowIndex;<br />
    protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
        if (!Page.IsPostBack)<br />
        {<br />
            DataTable dt = GetData();<br />
            if (dt.Rows.Count > 0)<br />
            {<br />
                // Populate the TextBox with the first entry on page load                <br />
                TextBox1.Text = dt.Rows[0]["Employee_Name"].ToString();<br />
                //Then we store the DataTable in Session so that we will NOT                <br />
                //query the DB on every postbacks                <br />
                Session["dt"] = dt;<br />
            }<br />
        }<br />
        <br />
    }<br />
<br />
    private DataTable GetData() <br />
    { <br />
        DataTable dt = new DataTable(); <br />
        cn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath("App_Data/employeedb.mdb")); <br />
        try { <br />
             cn.Open();<br />
             cd = new OleDbCommand("Select * from emptbl", cn);<br />
             //SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd); sqlDa.Fill(dt); <br />
             OleDbDataAdapter da = new OleDbDataAdapter(cd);<br />
             da.Fill(dt);<br />
            } <br />
        <br />
        catch (System.Data.OleDb.OleDbException ex) <br />
               { <br />
                  string msg = "Fetch Error:"; msg += ex.Message; <br />
                  throw new Exception(msg); <br />
               } <br />
                 finally <br />
                       { <br />
                           cn.Close();<br />
                            <br />
                       }<br />
        return dt;<br />
     }<br />
    protected void Button1_Click(object sender, EventArgs e)<br />
    {<br />
      //int rowIndex = 0; <br />
        rowIndex = +6;<br />
        TextBox1.Text = rowIndex.ToString();<br />
             <br />
        /*if (Session["dt"] != null)        <br />
          {            <br />
            DataTable dt = (DataTable)Session["dt"];            <br />
            if (rowIndex <= dt.Rows.Count)<br />
            {<br />
                          <br />
                //get the next row entry on Button Click by setting the Row Index                <br />
                TextBox1.Text = dt.Rows[rowIndex]["Employee_Name"].ToString();             <br />
            }        <br />
        }*/<br />
    }<br />
}<br />
<br />
<br />

AnswerRe: how to preserve the variable Pin
Robert_Pan26-Aug-09 18:58
Robert_Pan26-Aug-09 18:58 
GeneralRe: how to preserve the variable Pin
swtlibra26-Aug-09 19:00
swtlibra26-Aug-09 19:00 
AnswerRe: how to preserve the variable Pin
droth1727-Aug-09 4:51
droth1727-Aug-09 4:51 
QuestionRequired Field Validation not working Pin
shaik_mr26-Aug-09 18:43
shaik_mr26-Aug-09 18:43 
AnswerRe: Required Field Validation not working Pin
Robert_Pan26-Aug-09 18:50
Robert_Pan26-Aug-09 18:50 
AnswerRe: Required Field Validation not working Pin
Arun Jacob26-Aug-09 18:51
Arun Jacob26-Aug-09 18:51 
QuestionSharing ASP.NET MVC applications [modified] Pin
Chandrashekar Reddy26-Aug-09 16:29
Chandrashekar Reddy26-Aug-09 16:29 
AnswerRe: Sharing ASP.NET MVC applications Pin
N a v a n e e t h26-Aug-09 16:36
N a v a n e e t h26-Aug-09 16:36 
GeneralRe: Sharing ASP.NET MVC applications Pin
Chandrashekar Reddy26-Aug-09 16:48
Chandrashekar Reddy26-Aug-09 16:48 
GeneralRe: Sharing ASP.NET MVC applications Pin
N a v a n e e t h26-Aug-09 16:58
N a v a n e e t h26-Aug-09 16:58 
Question[Message Deleted] Pin
jhonrsa26-Aug-09 10:46
jhonrsa26-Aug-09 10:46 
AnswerRe: simple application Pin
Not Active26-Aug-09 10:51
mentorNot Active26-Aug-09 10:51 
AnswerCheck MSDN for tutorials on using the Login Control Pin
David Mujica26-Aug-09 11:02
David Mujica26-Aug-09 11:02 
AnswerRe: simple application Pin
Christian Graus26-Aug-09 15:02
protectorChristian Graus26-Aug-09 15:02 
Generalsimple application Pin
jhonrsa28-Aug-09 1:47
jhonrsa28-Aug-09 1:47 
AnswerRe: simple application Pin
Gaurav Dudeja India26-Aug-09 21:17
Gaurav Dudeja India26-Aug-09 21:17 
Questionhow to locate one button near right position of the screen? Pin
Seraph_summer26-Aug-09 10:20
Seraph_summer26-Aug-09 10:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.