Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5964131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:22:34+00:00 2026-05-22T19:22:34+00:00

int i = Convert.ToInt32(Session[sayfaTuru]); ClientScript.RegisterStartupScript(this.GetType(), RefreshOpener, f2( + i + ), true); function f2(i)

  • 0
int i = Convert.ToInt32(Session["sayfaTuru"]);            
ClientScript.RegisterStartupScript(this.GetType(), "RefreshOpener", "f2(" + i + ")", true);

function f2(i) {
            if (i == 1) {//CariKartHareketleri
                opener.document.getElementById("HiddenField1").value = "hello world";
                window.opener.location.href = window.opener.location.href; //çağıran sayfayı yeniliyor

            }
            else if (i == 2) {//islemler
                opener.document.getElementById("HiddenField1").value = "hello world";
                window.opener.__doPostBack('GridRefreshPanel.ClientID', '');

            }
            else if (i == 3) {//hizmet listesi
                opener.document.getElementById("HiddenField1").value = "hello world";
                window.opener.__doPostBack('GridRefreshPanel.ClientID', '');

            }

        } 

it says i is undefined when I debug the code in f2(i).What am i doing wrong?

EDIT: I learned many things from this problem, but I still do not have an answer.I tried every idea given in the answers but i is still undefined…

EDIT: I still have no solution for undefined reasons :), but the answer I accepted would normally be my solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:22:35+00:00Added an answer on May 22, 2026 at 7:22 pm

    Have you tried debugging the server-side code to see if

    int i = Convert.ToInt32(Session["sayfaTuru"]);
    

    is giving you what you want in the first place?


    Well seeing as how the above has been checked, I went ahead and created my own test, and it worked just fine. Here’s the test I used:

    JS:

    <script type="text/javascript">    
        function f2(i, hiddenFieldId, updatePanelId) {
    
            console.log(i + ', "' + hiddenFieldId + '", "' + updatePanelId + '"');
            var hiddenField = window.opener.document.getElementById(hiddenFieldId);
    
            switch (i) {
    
                case 1: //CariKartHareketleri
                    hiddenField.value = "hello world 1";
                    window.opener.location.href = window.opener.location.href; //çağıran sayfayı yeniliyor
                    break;
    
                case 2: //islemler
                    hiddenField.value = "hello world 2";
                    window.opener.__doPostBack('' + updatePanelId + '', '');
                    break;
    
                case 3: //hizmet listesi
                    hiddenField.value = "hello world 3";
                    window.opener.__doPostBack('' + updatePanelId + '', '');
                    break;
    
                default:
                    alert("error");
                    break;      
    
            }
        }
    </script>
    

    C#:

    Session["sayfaTuru"] = 2; // initialize for testing purposes
    
    int i = Convert.ToInt32(Session["sayfaTuru"]);
    
    string script = string.Format("f2({0}, '{1}', '{2}');", 
                                  i.ToString(), 
                                  this.HiddenField1.ClientID, 
                                  this.GridRefreshPanel.UniqueID);
    
    ClientScript.RegisterStartupScript(this.GetType(), "RefreshOpener", script, true);
    

    console.log Output:

    2, "HiddenField1", "GridRefreshPanel"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code works correctly to make a web service call: int numberOfGuests = Convert.ToInt32(search.Guest);
Why won't this simple subtraction work? int MyPageNumber = Convert.ToInt32(cboPageNumber.SelectedItem); MyPageNumber += (MyPageNumber -
Currently I have this: var x = Convert.ToString(dateTimePicker2.Value.Subtract(dateTimePicker1.Value)); int xDays = Convert.ToInt32(x.Substring(0,1)); But it's
What is the main difference between int.Parse() and Convert.ToInt32() ? Which one is to
Why does the statement (int)84 throw an exception and Convert.ToInt32(84) does not throw an
Which one is faster, powerfull and reliable. And why ? int.Parse() int.TryParse() Convert.ToInt32()
private void BindDataList() { int userId = Convert.ToInt32(ProfileInfo.GetUserID()); DataList1.DataSource = CatalogAccess.GetAddressByUserID(userId); DataList1.DataBind(); foreach (DataListItem
Console.WriteLine(Please enter your number of the Names : ?); int x = Convert.ToInt32(Console.ReadLine()); string[]
Possible Duplicate: difference between Convert.ToInt32 and (int) What it difference between (int) and convert.toint()
I have problem. I can' identify my mistake... int dt = Convert.ToInt32(Items.Rows[T1][F14].ToString().Trim()); int mn

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.