Advertisement

06.23.2008 at 12:08PM PDT, ID: 23508707
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

JavaScript:  Open/Close window on link click in C#

Asked by attaylor44 in JavaScript, C# Programming Language

Tags:

Background info:

I have a form, this form has a text box for searching and a button to search.  
On button click, a new window is opened with a gridview control that populates based on the search criteria entered in the main page. This grid view has buttonfield elements that allow the user to open form documents (insurance application) pre-populated with previously entered data.  

What happens on the click event of one of these buttonfields is I call a javascript function that calls the codebehind first to set sesson variables(not using query strings at all, so all insurance application ID information is set to a session variable).  Once the session variables are set, the page redirects to the specific url of the particular referenced applcation/form.

My problem is:  I have opened an insurance application for Client "A", I then minimize this window and am back to my main window, I perform another search, a new window is populated and I open an application for Client "B", the session variables are overwritten so that Client "B's" information is now available.  If I return to Client "A's" window and hit a save button, it overwrites client "B's" information in the database as it updates based on the session variable of an application ID.  

I need to ensure that if a new client's application is opened, the previous one is closed so that it cannot overwirte the wrong client's information.  I am attaching some code, but I think the concept is the bigger picture, I may even be going about this in the wrong direction, any other suggestions would be of great help as well.  Sometimes the straight forward answer isn't the best one!Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
Main Page:
 
//search section
<tr>
                <td>
                <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
                </td>
                <td>
                    <asp:Button ID="btnSearch" runat="server" Text="Search By FirmName" OnClientClick="Search()" OnClick="btnSearch_Click"  /></td>
            </tr>
 
 
JavaScript on main page:
function Search()
{
    
    <%=Page.GetPostBackEventReference(btnSearch as Control) %>
    
    window.open('/Pages/FirmSearch.aspx');
    
}
 
=====================================================
 
Codebehind for search button on aspx.cs page
protected void btnSearch_Click(object sender, EventArgs e)
        {
            Session["SearchText"] = null;
 
            Session["SearchText"] = txtSearch.Text.ToString() + "%";
            Session["searchText"].ToString();
        }
 
======================================================
 
 
Window with gridview:
 
<asp:GridView ID="gvFirmSearch" runat="server" AllowPaging="True" AutoGenerateColumns="False"
        CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None"
        Width="530px" OnSelectedIndexChanged="gvFirmSearch_SelectedIndexChanged" OnRowCommand="gvFirmSearch_RowCommand">
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="#EFF3FB" />
        <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" />
        <Columns>
            <asp:ButtonField DataTextField="firmname" HeaderText="Firm Name"  CommandName="OpenFirm" />
            <asp:BoundField DataField="email" HeaderText="email" SortExpression="email" />
            <asp:BoundField DataField="password" HeaderText="password" SortExpression="password" />
            <asp:ButtonField CommandName="OpenPIR" Text="Premium Indication" />
            <asp:ButtonField CommandName="OpenNewApp" Text="New App" />
        </Columns>
    </asp:GridView>
 
=======================================
codebehind for gridview click:
 
protected void gvFirmSearch_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string userid = gvFirmSearch.Rows[int.Parse(e.CommandArgument.ToString())].Cells[1].Text.ToString();
 
            e.CommandName.ToString();
            
 
            DataAccess.getClientIDByEmail(userid.ToString());
            DataAccess.getAppIDByClientID(Session["clientid"].ToString());
            Session["SignedIn"] = "1";
            
            if(e.CommandName.ToString() == "OpenPIR")
                Response.Redirect("/pages/PremiumIndication/PremiumIndication.aspx",false);
            else
	            if(e.CommandName.ToString() == "OpenNewApp")
                    Response.Redirect("/pages/NewApp/NewApp.aspx", false);
                else
                    if (e.CommandName.ToString() == "OpenFirm")
                        Response.Redirect("/pages/UserArea.aspx", false);
            
        }
[+][-]06.23.2008 at 12:13PM PDT, ID: 21849315

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.23.2008 at 02:54PM PDT, ID: 21850711

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 05:05AM PDT, ID: 21854730

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 09:12AM PDT, ID: 21857340

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 09:19AM PDT, ID: 21857414

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.25.2008 at 12:32PM PDT, ID: 21869094

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, C# Programming Language
Tags: C# ASP.NET, JavaScript
Sign Up Now!
Solution Provided By: attaylor44
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628