Skip to content

Request.Querystring not returning correct data

hirdesh ronaldo

Asked Feb 6, 2014, 1:45 AM EST3 answers
Share
LinkedInX
Hi All,
Thanks in adv,
I have prob in using Gridview and link button.
Scenerio : I have gridview and I am using link button in gridview.
-- code for creating link button in grid view.

<Columns>
 
<asp:TemplateField HeaderText="Tool Name" ItemStyle-HorizontalAlign="Left"
FooterStyle-HorizontalAlign="Center">
<ItemTemplate>                                                  
                                                      
<asp:LinkButton ID="lnkToolProc" runat="server" CausesValidation="False" Text='<%#Eval("varToolName") %>'></asp:LinkButton>
                                                                                                                          
</ItemTemplate>
</asp:TemplateField>

</Columns>

 
I have js function which I called on this link button click, I pass toolname as ID from link button to popup window.
javascript function :
function CallToolprocurement(id)
{
window.showModalDialog("ViewToolProcurement.aspx?id=" + id, "null", "status:no;dialogWidth:450px;dialogHeight:300px;dialogHide:true;help:no;scroll:no");
return false;          
}
On the popup window I am writing below code to get Id from previous page
 
string Toolname = Request.QueryString["id"].ToString(); // I m taking toolname in Id from previous page
 

Problem : Its working fine but problem is some toolname contains special char in name ex : msdn 3.5&4.0  and "

Adobe® Digital Publishing Suite"  So while getting toolname from request.querystring I am not getting complete name. Its break after special char. ex :

Adobe® Shadow : not getting same name.
AT&T : getting only AT , missing T
 
 
Can you pls help me how to resolve it or any alternative to achieve same functionality.
 
 
Thanks a lot !!

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Pradip Daingade
    0
    Try This
    Div
    ParentWindow.aspx:

     

    ParentWindow.aspx.cs:

    PowerShell
    private void Page_Load(object sender, System.EventArgs e)
    {
     // Insure that the __doPostBack() JavaScript method is created...
     this.GetPostBackEventReference(this, string.Empty);
    
    
     if ( this.IsPostBack )
     {
      string eventTarget = (this.Request["__EVENTTARGET"] == null) ? string.Empty : this.Request["__EVENTTARGET"];
    
    
      if ( eventTarget == "ChildWindowPostBack" )
       Response.Write("Session: [" + this.Session["ChildWindowKey"] + "]
    ");
     }
     else
     {
     }
    }

    ChildWindow.aspx:

     


    ChildWindow.aspx.cs:

    TypeScript
    protected void postBackButton_Click(object sender, EventArgs e)
    {
     this.Session["ChildWindowKey"] = "Value from child window";
    
    
     this.RegisterStartupScript("CloseWindowScript", "");
    }
    0
  • 0
    Hi Pradip,
    Thanks for your reply...

    but prob is I dont want to do anything on child window .. on child window just I am displaying record .... These record I am taking from database based on id passed from parenet page.


    I dont think this solution works..
    Please provide any other sol....
    Thanks a lot for your reply...
    0
  • Pradip Daingade
    0
    Try This
    window.showModalDialog("ViewToolProcurement.aspx?id=" + id + ", "status:no;dialogWidth:450px;dialogHeight:300px;dialogHide:true;help:no;scroll:no");
    return false;
    0