Click here to Skip to main content
15,900,108 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Formatting currency Pin
Sandeep Mewara28-Jun-10 19:32
mveSandeep Mewara28-Jun-10 19:32 
QuestionRad ListBox Pin
indian14328-Jun-10 9:41
indian14328-Jun-10 9:41 
AnswerRe: Rad ListBox Pin
netJP12L28-Jun-10 11:25
netJP12L28-Jun-10 11:25 
Questionfolder name in iis 7 Pin
netJP12L28-Jun-10 9:35
netJP12L28-Jun-10 9:35 
GeneralRe: folder name in iis 7 Pin
Paladin200028-Jun-10 10:58
Paladin200028-Jun-10 10:58 
GeneralRe: folder name in iis 7 Pin
netJP12L28-Jun-10 11:22
netJP12L28-Jun-10 11:22 
GeneralRe: folder name in iis 7 Pin
Laxman Auti28-Jun-10 20:48
Laxman Auti28-Jun-10 20:48 
QuestionSession data takes two button clicks to work? Pin
Jacob Dixon28-Jun-10 9:19
Jacob Dixon28-Jun-10 9:19 
I have a inventory application that pulls data from our database.

So on a page called loggedin.aspx I have two drop down list on the left and a DATALIST (with a pageddatasource) on the right. Now the two boxes on the left let you choose the CITY and the YEAR for the inventory.

Once you select both drop a drop down and click GO it sets the session variables:
protected void btnGo_Click(object sender, ImageClickEventArgs e)
    {
        if (ddlJUR.SelectedIndex != -1)
            Session["JUR"] = ddlJUR.Items[ddlJUR.SelectedIndex].Text;

        if (ddlFY.SelectedIndex != -1)
            Session["FY"] = ddlFY.Items[ddlFY.SelectedIndex].Text;
    }


Now on page load it should be pulling data from the database based on those values. It should also be setting a label stating which values you ahve chosen and also selecting the correct jurisdiction/ fiscal year from the drop down box:
protected object FY;
protected object JUR;

        FY  = Session["FY"];
        JUR = Session["JUR"];

        if (JUR == null)
            lbBreadCrumb.Text = "Please select the jurisdiction from the left.";
        else if (FY == null)
        {
            ListItem iJUR = ddlJUR.Items.FindByText(JUR.ToString());
            if (iJUR != null)
                ddlJUR.SelectedIndex = ddlJUR.Items.IndexOf(iJUR);

            lbBreadCrumb.Text = JUR.ToString() + " > " + "-Please select the Fiscal Year from the left-";
        }
        else
        {
            lbBreadCrumb.Text = JUR.ToString() + " > " + FY.ToString();

            ListItem iJUR = ddlJUR.Items.FindByText(JUR.ToString());
            if (iJUR != null)
                ddlJUR.SelectedIndex = ddlJUR.Items.IndexOf(iJUR);

            ListItem iFY = ddlFY.Items.FindByText(FY.ToString());
            if (iFY != null)
                ddlFY.SelectedIndex = ddlFY.Items.IndexOf(iFY);

            if (!IsPostBack)
            {
                BindData();
            }
        }



It doesn't seem to work though. You have to click the go button twice. Iti s like the session variable doesnt set before the postback happens and the page is loaded??
AnswerRe: Session data takes two button clicks to work? Pin
Ennis Ray Lynch, Jr.28-Jun-10 9:31
Ennis Ray Lynch, Jr.28-Jun-10 9:31 
GeneralRe: Session data takes two button clicks to work? Pin
Jacob Dixon28-Jun-10 9:33
Jacob Dixon28-Jun-10 9:33 
GeneralRe: Session data takes two button clicks to work? Pin
Jacob Dixon28-Jun-10 9:45
Jacob Dixon28-Jun-10 9:45 
GeneralRe: Session data takes two button clicks to work? Pin
Ennis Ray Lynch, Jr.28-Jun-10 9:55
Ennis Ray Lynch, Jr.28-Jun-10 9:55 
GeneralRe: Session data takes two button clicks to work? Pin
Jacob Dixon28-Jun-10 10:15
Jacob Dixon28-Jun-10 10:15 
GeneralRe: Session data takes two button clicks to work? Pin
Ennis Ray Lynch, Jr.28-Jun-10 10:41
Ennis Ray Lynch, Jr.28-Jun-10 10:41 
GeneralRe: Session data takes two button clicks to work? Pin
Jacob Dixon28-Jun-10 11:00
Jacob Dixon28-Jun-10 11:00 
GeneralRe: Session data takes two button clicks to work? Pin
Ennis Ray Lynch, Jr.28-Jun-10 11:15
Ennis Ray Lynch, Jr.28-Jun-10 11:15 
QuestionPassing a value from an ASP.Net page to a HTML Page Pin
PDTUM28-Jun-10 6:31
PDTUM28-Jun-10 6:31 
AnswerRe: Passing a value from an ASP.Net page to a HTML Page Pin
Ennis Ray Lynch, Jr.28-Jun-10 7:43
Ennis Ray Lynch, Jr.28-Jun-10 7:43 
AnswerRe: Passing a value from an ASP.Net page to a HTML Page Pin
T M Gray28-Jun-10 7:45
T M Gray28-Jun-10 7:45 
GeneralRe: Passing a value from an ASP.Net page to a HTML Page Pin
PDTUM28-Jun-10 12:19
PDTUM28-Jun-10 12:19 
Questionresponse.redirect gives -400 error. Pin
vjvjvjvj28-Jun-10 5:48
vjvjvjvj28-Jun-10 5:48 
Answer[CrossPost]: response.redirect gives -400 error. Pin
Sandeep Mewara28-Jun-10 6:12
mveSandeep Mewara28-Jun-10 6:12 
QuestionAccess masterpage control in contentpage codebehind Pin
Hardus Lombaard28-Jun-10 4:55
Hardus Lombaard28-Jun-10 4:55 
AnswerRe: Access masterpage control in contentpage codebehind Pin
Brij28-Jun-10 4:59
mentorBrij28-Jun-10 4:59 
AnswerRe: Access masterpage control in contentpage codebehind Pin
T M Gray28-Jun-10 7:15
T M Gray28-Jun-10 7:15 

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.