Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

First question, do you already have the connection setup in your C# application to the Access DB?

Second Question, are you already passing information to the Access DB from your C# application?

If (first == "yes" && second == "yes")... sorry, but um ya if you answered yes to both of those questions then I'm assuming you're just looking to find out how to read the value of the radiobutton.

If the answers are no, then your question is how to establish the connection and pass data from the app to Access?

If it's the first, then there's 3 pieces of information (generally) that are of any use in a radiobutton (4 if you include the group that it belongs to), it's name, text and it's checked state.

First, make sure the RadioButton's permission is set to anything except private.

  • Obtaining the checked state is simple by using radioBoxName.Checked you will return a bool value.
  • The radiobox name is radioBoxName.Name which returns a string value.
  • The radiobox text (what is shown on the user end) is radioBoxName.Text which also returns a string value.

A solid tutorial for setting up your connection properties to connect to the Access Database can be found HERE and then from there it's just a matter of passing the collected variables to the required table/row/columns.

Hope this helps to some degree. The request was somewhat vague so I'm sorry if I went into too much …

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I'm still curious where you're deriving the values that are being inserted based on the original code but I'm glad it was solved :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

For starters I'm not sure about the INSERT statement you're using, also where is the information being derived from? Another table? An application?

Your use of:

INSERT INTO [TABLE] (Col1, Col2, Col3, Col4) SELECT '1', '2', '3', '4' ;

seems incorrect to my knowledge as I'd always known it as:

INSERT INTO [TABLE] {Col1,Col2,Col3,Col4} VALUES {Val1,Val2,Val3,Val4}

at that point you can declare the valuables to match your input requirements (whatever they may be).

If the values are being derived from an application source of some sort a basic loop on the application end would suffice to input your values to the DB, if they're being derived from another table then I'm not seeing where in your example you're collecting those values to assign to the new table.

If the values are derived from a 2nd table then you would probably use something more like this:

INSERT INTO [TABLE] {Col1,Col2,Col3,Col4} VALUES {SELECT Val1,Val2,Val3,Val4 FROM [TABLE2] WHERE row=counter}

assuming you have some sort of numerically indexed column in the 2nd table.

I, personally, if transferring data from table2 (or even tables 2,3,4 & 5) to table1 would likely invest the 5 minutes to create a simple win-forms app to do it and build the world's simplest data loop lol but that's me.

On re-reading your post though, are you trying to input just the values "1" "2" "3" and "4" into the 4 columns repeatedly without an external data source? If So, then:


       
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Phil, if the issue has been resolved you may want to look into marking this thread as 'solved' so it doesn't look as though it's still an active thread ;) Glad you figured it out though.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Well... what I might suggest is that you ask the friendly folks at DotNetNuke since it is their application package and you've provided no code for anyone to work with in your post.

Generally speaking if you're having a problem with a pre-packaged software solution the best people to ask would be the people who pre-packaged it :)

Just my opinion though.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Excellent post... Just about anyone could replicate your results by following these steps even if they've never used photoshop before. Great job :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

The basic principles of database connection remain the same between ASP.Net and Windows forms based applications. The only difference is that you are connecting to the DB from your local machine instead of from the webserver.

That being said, if the SQL Server is being hosted via a DNS you can connect using the URL to the server or the IP of the server just like you might connect to a remote SQL server from a web-app built on a separate server.

As bondo said the rest depends on server settings and such to ensure that your connection protocols match on both client and server side.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Did you even try Google?

LoL Y'know, I was thinking the same thing...

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster
using System.Drawing;

should work assuming that you have a properly installed Visual Studio suite. There is the off chance that you may have to install the SDK for it (like you used to have to do sometimes for VS 2005 Express). If this is the case you should be able to find the VS 2008 SDK on the microsoft site.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Per the discussion in this site you might be able to achieve what you're looking for with one of the following:

top.focus()
parent.focus()

Apparently, however, this will not work in Internet Explorer.

It appears that there are a number of items within the iframe framework that do not work properly with IE however. Unless your target audience is guaranteed not to be using IE for their browsing I would possibly look into alternatives to the iframe construct.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Generally I use Adobe Fireworks for all of my animated GIF files.

However, the Adobe suite is far from "free" lol.

I might check on the Tucows download page for possibly shareware or freeware GIF animators but I wouldn't be able to speak to the quality of anything you get for free.

Mark solved if this helped solve your problem :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

An alternate method would be to do it this way:

#MenuDiv {
	position: absolute;
	top:150px;
	left: 25px;
	width: 120px;
}

#MenuTable {
	table-layout: width: 120px, padding: 0px, margin: 0px;
}

.menuTopRow {
	text-indent: 20px;
	font-size: 12px;
	font-weight: bold;
}
.menuTopRow:hover {
	background: url(test.png) no-repeat;
}
.menuSubRow {
	text-indent: 20px;
	padding-left: 5px;
	font-size: 11px;
	font-weight: bold;
}
.menuSubRow:hover {
	background: url(test.png) no-repeat;
	background-position: 5px;
}

Then the following in the HTML:

<div id="MenuDiv">
<table id="MenuTable">
  <tr>
    <td class="menuTopRow"><a href="Aboutus.html">About Us</a></td>
  </tr>
  <tr>
    <td class="menuSubRow"><a href="Who.html">Who We Are</a></td>
  </tr>
  <tr>
    <td class="menuSubRow"><a href="What.html">What We Do</a></td>
  </tr>
  <tr>
    <td class="menuTopRow"><a href="Services.html">Services</a></td>
  </tr>
  <tr>
    <td class="menuSubRow"><a href="Service1.html">Service 1</a></td>
  </tr>
  <tr>
    <td class="menuSubRow"><a href="Service2.html">Service 2</a></td>
  </tr>
  <tr>
    <td class="menuSubRow"><a href="Service3.html">Service 3</a></td>
  </tr>
  <tr>
    <td class="menuTopRow"><a href="Contact.html">Contact Us</a></td>
  </tr>
</table>
</div>

In my example I pushed the text-indent by 20px because the image I was using was 20x20px in size for the hover.

With this method, as the background is being called on specific cell hovers instead of generally between both list and sublist hovers it only triggers the image over the selected line and not the line plus it's parent.

Mark as solved if this fixes your issue :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Check the MSDN site for details on configuring Microsoft products such as IIS.

Visual Studio suite configuration information is available at their site as well.

If you're familiar with VB or C# you should have minimal difficulty transitioning to ASP.Net coding as most of the code-behind involved is in either of those 2 languages. Some of the front end development is slightly different from developing for a windows forms application but not so much so that it'd be impossible to work through.

There are a number of excellent tutorial sites and information forums (such as this one) that can help you through the rough patches as you first get moving in the web application direction.

Hope that helps :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

personally when populating from a dataset to any other type of container I use the following loop to ensure I get all the values. Since you didn't include any code to see what your current binding logic looks like I'll give an example below:

for (int a = 0; a < dataSetName.Tables["0"].Rows.Count; a++)
{
    DataRow dataRowName = dataSetName.Tables["0"].Rows[a];
    insert data item setup here
    dataListName.Items.Add(dataItemName);
}

Once the loop terminates all items from the original dataset table should be within the new datalist. If the list is only to be populated once then I would ensure that the procedure for this load is within a segment such as:

if (Page.IsPostBack == false)
{
    datalistGenerator();
}

Or... failing that, include a

dataListName.Items.Clear();

line pre-loading to ensure that you don't duplicate your entries.

Hope this helps, please mark solved if it does :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I might try something like the following in your code-behind:

string[] inTOKOset = inTOKO.Split(',');
string selCommand = "SELECT ID, NAMA FROM REF_TOKO WHERE ID='";
if (inTOKOset.Length > 1)
{
    for (int a = 0; a < inTOKOset.Length; a++)
    {
        if (a < inTOKOset.Length - 1)
        {
            selCommand += inTOKOset[a] + "' AND WHERE ID='";
        }
        else
        {
            selCommand += inTOKOset[a] + "' ORDER BY NAMA";
        }
    }
}
else
{
    selCommand += inTOKOset[0] + "' ORDER BY NAMA";
}
SqlDataSource6.SelectCommand = selCommand;

I'm sure there's an easier way where a collection of strings can be passed in one WHERE query segment but this should at least get you working.

Mark as solved if this clears up your issue ;)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

A slightly longer version of converting your data both ways to/from the server would be in the methods I'll list below. Keep in mind that my 'sample' was drawn up without an actual masked textbox (just straight textbox) but the processes should work if my brain hasn't completely stopped working.

Essentially my example will take a masked value of, say: $___555___.00
change it to an unmasked value of: 555.00
then convert it to a double for ease of conversion to Money datatype when sent to the server.

char[] splits = {'$','_'};
        string maskedValue = maskedTextBox.Text;
        string[] maskedSegs = maskedValue.Split(splits);
        string strippedValue = "";
        for (int a = 0; a < maskedSegs.Length; a++)
        {
            if (maskedSegs[a].Length > 0)
            {
                strippedValue += maskedSegs[a];
            }
        }
        maskStrippedTextBox.Text = strippedValue;
        double toServerValue = Convert.ToDouble(strippedValue);

On the return trip from the server we can immediately convert the returned value to a string as part of the variable population so I skipped that step.

Example checks for the position of the decimal (assuming there is one) and if required adds the appropriate components of .00 to the end of the value returned.
Example then checks the length of the value to determine if it's shorter than the original masked value lengths and if it is (which it should be, having been derived from the masked input) adds $__ with as many "_" as needed to fill to full length before returning the new re-masked value to the box.

//assume …
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Ya, my website follows the alternate image path concept as indicated above.

As I said last night, I was just trying to give an 'idea' of how to do it, not be the definitive answer to their needs lol. It was far too late in the evening for me to be doing all their work for them ;)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Well I'm glad we finally got to the root of the issue (the login=null part) and you got it figured out :D 4:11am here, I'm goin' to sleep now lol.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

c# coding....

partial class Form1

String str1 ;

Private Sub Button1_Click(...)
str1 = "some text";
End Sub

Private Sub Button2_Click(...)

Messagebox.Show(str1);

End Sub

That certainly looks like VB coding and looks almost identical to the original post. *shrug* I still say the culprit is using Messagebox in a webapp but what do I know ;) it's 3:30am here.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

My eyes are burning lol.

I must've missed that step where you initialized login before, sorry.

Well, dude, I'm flat out of ideas.

I've never directly worked with remoting applications like you're doing here so I don't know if there are specific variables to the way this process works that are different between web and windows forms apps.

As I follow your code step by step it all appears fine, I'm not seeing any particular reason why it won't work.

The System.NullReferenceException you are getting indicates to me that you're calling on a variable that 'doesn't exist' somewhere but the point at which it gives it would narrow it down to either txtun.Text or your interface 'login.CheckUN()'. If it was the latter, I would assume the error message would indicate a specific position within the CheckUN procedure where it was running into an issue unless it was 'login' itself that was coming back null... WAIT!!!

#
ILogin login=null;
 
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
try
{
ChannelServices.RegisterChannel(new TcpChannel());
login=(ILogin)Activator.GetObject(typeof(LoginComponent.ILogin),"tcp://localhost:6392/theLogin");
}
catch(Exception ex)
{
lbls.Text=ex.ToString();
}

If you are using visual studio, set a breakpoint at the end of this segment and go into debug mode. I'm willing to bet that "login=(ILogin)Activator.GetObject(typeof(LoginComponent.ILogin),"tcp://localhost:6392/theLogin");" is your culprit right there as it's in a 'Try' block and if it fails leaves login = null. I'll even go so far as to narrow it down to just the ""tcp://localhost:6392/theLogin"" portion …

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I just had a thought...

I've never used MarshalByRefObject so I'm not 100% on how it works. I'm assuming that your ILogin interface indirectly initializes your Login class through the statement

public class Login : MarshalByRefObject, ILogin

is this correct?

Because the only thing I can think of is that the Login class isn't initialized in the .cs file for the webform but I'm sure that it is or you'd be receiving some very angry errors from implementing

bool st=login.CheckUn(txtun.Text);

My assumption here (having not used MarshalByRefObject before) is that the call to

ILogin login=null;

works in a similar way to

Login myLogin = new Login()

Is that correct?

Now, your most recent post about the actual error message gets me thinking that the initialization issue might be in fact the case as the error indicates that you are pointing to a value that isn't initialized somewhere.

Based on the error segment it spat out:

Line 224: private void btnsign_Click(object sender, System.EventArgs e)
Line 225: {
Line 226: bool st=login.CheckUn(txtun.Text);
Line 227: }

It's indicating that one of 2 things (from what I can see) is not 'present' to the system. Those being login.CheckUN or txtun.Text. The issue could be that the .Text value for txtun is being lost somehow in the button click (unlikely since it would at the least provide a "" value) or that (as I theorized above) login is not initialized properly.

Sorry I got so …

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Well I'm making the assumption that your DBConnector function is well formed as you didn't include any of it's code but...

Assuming that the db connection properties are well formed I'm not seeing any issues with your code off-hand.

An example of what I generally utilize in web-apps for DB connection would be:

blConn loadConn = new blConn(); //Represents separate class for DB connection strings to mask from primary class

    private bool checkUN(string userName)
    {
        string connStr = @loadConn.cString;
        SqlConnection loadMsgConn = new SqlConnection(@connStr);
        SqlCommand loadMsgCmd = new SqlCommand();
        loadMsgCmd = loadMsgConn.CreateCommand();
        loadMsgCmd.CommandText = @"select * from Customer_Details where cUser_Name='@un'");
        loadMsgCmd.Parameters.Add("@un", SqlDbType.VarChar);
        loadMsgCmd.Parameters["@un"].Value = userName;
        loadMsgConn.Open();
        int queryReply = loadMsgCmd.ExecuteNonQuery();
        bool respond = false;
        if (queryReply > 0)
        {
            respond = true;
        }
        return respond;
    }

Bear with my code as the names are from a cut'n'paste from a project I recently was working on. Essentially, assuming your SQL connection string is correctly set and you pass userName to the process it should return a bool reply based on a 0 or non-0 reply to the SQL query.

Alternately you can do this method:

blConn loadConn = new blConn(); //Represents separate class for DB connection strings to mask from primary class

    private bool checkUN(string userName)
    {
        bool respond = false;
        string connStr = @loadConn.cString;
        SqlConnection loadMsgConn = new SqlConnection(@connStr);
        SqlDataAdapter loadMsgAdapt = new SqlDataAdapter(@"select * from Customer_Details where cUser_Name='"+userName+"'", loadMsgConn);
        SqlCommandBuilder loadMsgBuilder = new SqlCommandBuilder(loadMsgAdapt);
        DataSet loadMsgSet = new DataSet();
        loadMsgAdapt.Fill(loadMsgSet, "unCheck");
        loadMsgConn.Close();
        if (loadMsgSet.Tables["unCheck"].Rows.Count > 0) …
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Below is a brief example where I've done some (but definitely not all) of your CSS conversion for you. I would recommend that you check into some CSS tutorials to get a better understanding of how they work.

First, the CSS code (I've named my file test.css):

@charset "utf-8";
/* CSS Document */

#Body {
	background-color: #F0F;
	font-family: "Times New Roman", Times, serif;
	font-size: 12px;
}
#NavTable {
	border: none;
	padding: 0px;
	margin: 0px;
	width: 100%;
}
.title {
	text-align: center;
	font-size: 6em;
	font-weight: bold;
}
.menuItems {
	text-align: center;
	font-size: 5em;
}

Followed by the HTML page (aptly named test.html):

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
@import url("test.css");
-->
</style>
</head>

<body id="Body">
<table id="NavTable">
<tr><td>
<p class="title">Davina's Web Page</p>
<p class="menuItems"><a href="Family.htm">Family</a>&nbsp; |&nbsp; <a href="Friends.htm">Friends</a>&nbsp;
|&nbsp; <a href="Movies.htm">Interest</a>&nbsp; |&nbsp; </font>
<a href="Feedback.html">Feedback</a></p>
<p align="center">&nbsp;</p>
</td></tr>
</table>
</body>
</html>

Hope this helps. Sorry but I'm too tired and it's too late in the day for me to do your entire page for you. It should, at the very least, give you an idea of how CSS IDs and Classes work however. ;)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Here is an article dealing with cross compatibility of COM versions. Might have something to do with your scenario if perhaps there's a different version of Access on your laptop than there is on your other 2 test units.

This link also relates to varying versions of Access and related COM libraries required.

Based on your post, the VB application uses Access 12.0 Object Library to Communicate with Access 2007. If you would like to use the related objects in 2003 version, you need to change or add the reference for Access 11.0 Object Library. Furthermore, you need to make sure the Access 2007/2003 is installed on the target computer you would like to run the application.

I believe the issue isn't with the database being connected to but the COM library being used to access the local version of Access on the machine the site is being run on. What you may want to do is confirm the installed versions on the various machines that the web-app is going to be run on to ensure that all the required COMs are being supported in your app.

Hope this helps ;)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I could be wrong here but textun.Text would be a text box within the web form itself not a variable to be initialized.

The way I'm reading it he's passing the text value of a TextBox named "textun" to a process named "CheckUN" within class "login".

Beyond that, as I look through the code, I'm not seeing any reason (provided all the classes and interfaces are properly initialized) that you wouldn't be receiving a true/false response from your bool inquiry in the above code segments.

As a side note, your sql query to determine merely if there is or isn't a username that matches in the DB can be accomplished using ExecuteNonQuery() instead of using a reader since all you need to know is whether there are rows returned or not. ExecuteNonQuery() will return a numeric value only as an indication of affected rows so your code could be set to trigger on 0 or > 0 results instead. But that's just my thougt on the matter ;)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Just to clarify, if you can separate your databinds from your selection processes such that the databinds happen once and the selection processes don't repeat the binds unnecessarily I think this might solve your problem.

However, I've spent the last 4 days putting in 12-14 hour days of coding on a C# ASP.Net project of my own and my brain isn't working at peak at the moment ;)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I can't help wondering if this is a similar issue to the one I was having with dynamically populated ListBox controls losing their databinds during postbacks.

I will admit, I only skimmed through your code and there is so much going on dynamically that it's hard to say. My thought is that when the radio buttons are dynamically loaded the first time around and then selected... and then the load process is repeated (on call of CallPageLoad()) it may be changing the values of the radioboxes or losing the selected values in the re-processing of the dynamic content.

Perhaps there is some way you can trigger your responses without re-loading the entire process such that the original data is preserved?

Again I could be way off-base here and feel free to completely ignore me lol :P

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I was recently having the exact same problem with a listbox control on my site.

The problem, as it turns out, was that the information bindings were being constantly changed every time the page was loaded (postback or otherwise).

I believe that if you change it so that the actual databind process is accomplished within the vb equivalent of below, it might work out for you:

if (Page.IsPostBack == false)
{
    ...page's databind processes here...
}

For example on my site's journal view page my Page_Load segment looks like this:

protected void Page_Load(object sender, EventArgs e)
    {
        //Split query pos 1 = Post Number
        string getQuery = ClientQueryString; //obtain variables from passed link ?orig=#&resp=#
        string[] querySplit = getQuery.Split('=', '&');
        origNum = Convert.ToInt16(querySplit[1].ToString());
        listedPage.Text = Convert.ToString(origNum);
        if (Page.IsPostBack == false)
        {
            loadMessageList();
            loadRespList(origNum);
        }
        navButtonSetup();
        if (origNum != -1) //if passed replyID != -1 load passed ID
        {
            loadMessage(origNum);
        }
        else //if passed replyID == -1 load lowest ID
        {
            origNum = lowestPost;
            loadMessage(lowestPost);
            if (Page.IsPostBack == false)
            {
                loadRespList(lowestPost);
            }
            navButtonSetup();
        }
        if (listRespBox.Items.Count > 0)
        {
            listRespButton.Visible = true;
        }
    }

However if I did the loadRespList or loadMessageList segments outside of the if (Page.IsPostBack == false) constructs I would receive the same error you reported with your code.

I hope this helps! :D Mark as solved if it does.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

It's a Web from.... it's there on my first post. tnx

I must be missing something then because I've never seen MessageBox utilized in a web form. Though I have seen similar effect with the use of JavaScript.

In either event, the declaration/usage is correct for the variable in the 2-3 examples given but not seeing the actual physical use the variable is going to be given is throwing me off.

If all you want is to display the results of a passed variable, however, you can always use <ASP:Label> or textbox for output onto the screen or I believe that an Alert tag will give the same effect as a MessageBox as such (just format the alert tag into the button2_click process on the front end and have it utilize a value of a hidden label for it's input):

<script type="text/javascript">
<!--

alert ("This is a JavaScript ALERT box.")

// -->
</script>
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

This should work... I'm assuming you're working a windows forms app and not a web app based on your use of MessageBox.

As long as the first line is in the initial declarations of your code you should be able to access it from any function within.

If you need to access it from outside the class entirely (ie from another class or in the case of a web app from the asp code itself) then you'll need to add 'public' in front of the declaration for outside code to be able to see the variable.

As I look at it after the fact it's almost identical to the code provided by the previous person so I'm not sure why it wouldn't be working for you.

string str1 = "";

protected void Button1_Click(object sender, EventArgs e)
{
    str1 = "some text";
}

protected void Button2_Click(object sender, EventArgs e)
{
    MessageBox.Show(str1);
}
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

While I'm not a fan of linking info from one site to another (kinda like standing in a restaurant shouting "go eat at the one across the street") I believe that this post at the asp.net forums might be of assistance to you.

Check the replies by scottim to the question asked.

Post Link -> For convenience sake I'll post the pertinent portions below but I hate to take someone's info without due credit is all:

One simple way is to add a literal to your page. Set the literal text to be <input type="hidden" name="ticks" value="..."/>, where the "..." is replaced by something unique to each request (e.g. System.DateTime.Now.Ticks.ToString()). In the button's OnClick handler, check if Session["ticks"] is the current posted value of the "ticks" hidden field (Request["ticks"]). If so, return without doing anything. Otherwise, execute the rest of the handler logic. At the end of the handler, set Session["ticks"] to the current posted "ticks" value.

1. Save the code below to page.aspx.
2. Browse to page.aspx (see label text "GET").
3. Click the button to post (see label text "Real POST").
4. Refresh the page (see label text "Refresh POST").
etc...

<script runat=server language=cs>
public void Page_Load() {
string ticks = Request["ticks"];
string sessionTicks = (string)Session["ticks"];
if (IsPostBack) {
if (ticks == sessionTicks) {
lb.Text = "Refresh POST";
}
else {
lb.Text = "Real POST";
Session["ticks"] = ticks;
}
}
lit.Text = "<input type=\"hidden\" name=\"ticks\" value=\"" + …
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

When I go to the 2 pages you indicate for the error I receive the following:

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

The settings you currently have in your Web.Config file are preventing remote viewing of your errors so perhaps if you were to copy/paste the error as you're seeing it, it might be easier for people to help diagnose the problem.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

OK... so... after ALL of that...

I just made the following changes to the code and it works flawlessly now.

public partial class blogged : System.Web.UI.Page
{
    static int testMessageID = 0;
    static int lastMessageID = 0;
    static int firstMessageID = 0;
    static int currentMessageID = 0;
    static int prevMessageID = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            firstLoad();
        }
    }

    private void firstLoad()
    {
        getFirstMessageID(true);
        getLastMessageID(true);
        currentMessageID = lastMessageID;
        loadMessage();
    }

Thanks for the attempted help though :D

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

After running extensive debugging I've found that it seems to be working properly for prior message (stepping back by 1 for the value of mID) however for some reason it seems to be reverting the currentMessageID to 5 prior to applying the + 1 for the next message portion...

I'm baffled as to why it would do that when there are at least 2 places in the code where it should be updating the currentMessageID to the messageID that is currently displayed on the page.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Yousuf,

Thanks for the speedy reply but the situation is that there is no reason for there not to be a row in this instance.

My test scenario was as follows:

1. Display most recent message (mID = 5)
2. Navigate to prior message (mID = 4) using currentMessageID -= 1
3. Navigate to next message (mID = 5) using currentMessageID += 1

Logically speaking as the only difference between the functions is + vs - it should have displayed the most recent, 2nd most recent, then most recent again.

Instead, it shows the most recent, 2nd most recent, then gives the indexOutOfRageException error.

I can't for the life of me see the logic error in my code to solve it either...

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I'll preface this by giving a bit of an overview of what I'm trying for here.

I'm trying to create a quasi-blog. Something that I can "post" journal type entries directly to a page in my website but without all the luggage that comes with the readily available blog engines and without viewer reply capability.

Essentially it's just going to be an interface where I can enter a post which gets stored on a database and a dynamically loading page that shows the most recent post with the option to navigate to prior posts (and back forward again).

Here's the thing... I can get my dynamic page to show the 'current' or most recent post, I can get it to navigate backwards through posts... but when I try to navigate forward again I get System.IndexOutOfRangeException: There is no row at position 0.

the only difference between the two functions of the page is that the "Previous Post" button is geared to utilize

currentMessageID -= 1;

and the "Next Post" button instead does += 1. currentMessageID is, of course, the MessageID variable that determines which message number I'm attempting to get from the database in my SELECT statement.

Pertinent pieces of the code are below... any help is appreciated.

public partial class blogged : System.Web.UI.Page
{
    bool firstLoader = true;
    int testMessageID = 0;
    int lastMessageID = 0;
    int firstMessageID = 0;
    int currentMessageID = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        getFirstMessageID(true);
        getLastMessageID(true);
        if …