2016-11-14 1 views
0

J'ai essayé d'utiliser le panneau de mise à jour dans la page aspx pour éviter l'actualisation de la page après un clic de bouton mais dans mon code j'ai utilisé le contrôle Ajax pour utiliser asp: ToolkitScriptManager un scriptmanager peut être ajouté à la page ".without notation ajaxtoolkit ne travaillera pas.Veuillez s'il vous plaît quelqu'un peut me suggérer comment surmonter ce problème et comment éviter l'actualisation de la page après un clic sur le bouton. mon code: kgis.aspxcomment utiliser à la fois scriptmanger et gestionnaire ajaxtoolscript dans une seule page ASPX?

  <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
      <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
       <ContentTemplate> 
      <asp:HiddenField ID="currTab" runat="server" /> 
     <asp:Panel ID="tabPanel" runat="server"> 
     <ul> 
      <li><a href="#Panel1" style="padding-left:8px;"><span>General Feedback</span></a></li> 
      <li><a href="#Panel2" style="padding-left:6px;"><span>New Requirements</span></a></li> 
      <li><a href="#Panel3" style="padding-left:8px;"><span>My Feedback</span></a></li> 

     </ul> 

     <%-- general feedback tab--%> 

    <asp:Panel ID="Panel1" runat="server"> 

      <div class="tabcaption">General Feedback</div> 

     <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager> 
      <table class="general"> 
           <tr> 
        <td style="padding-left:22px;">1.Did you find the information you were looking for?</td> 
            </tr> 
            <tr> 
        <td style="padding-left:30px;"> if no please explain why?</td> 

        </tr> 
         <tr > 
        <td style="padding-left:28px;"> 
         <div id="RadioDiv1"> 
       <asp:RadioButtonList ID="radiolist1" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="radio1"> 
          <asp:ListItem Value="yes">Yes&nbsp;&nbsp;&nbsp;</asp:ListItem> 
          <asp:ListItem Value="no">No</asp:ListItem> 
         </asp:RadioButtonList> 
        </div> 
       </td> 
       </tr> 

       <tr > 

        <td > 
         <div id="info" style="padding-left:64px;">Please Explain: 
          <asp:TextBox ID="infodesc" runat="server" CssClass="textb" TextMode="MultiLine"></asp:TextBox> 
        </div> 
        </td> 
       </tr> 

        <tr> 
        <td style="padding-left:22px;"> 2.Did the portal meet your need/ answer your questions?</td> 
          </tr> 
            <tr> 
        <td style="padding-left:30px;"> if no please explain why?</td> 

        </tr> 
         <tr > 
        <td style="padding-left:28px;"> 
         <div id="RadioDiv2"> 
       <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="radio1"> 
          <asp:ListItem Value="yes">Yes&nbsp;&nbsp;&nbsp;</asp:ListItem> 
          <asp:ListItem Value="no">No</asp:ListItem> 
         </asp:RadioButtonList> 
        </div> 
       </td> 
       </tr> 
       <tr > 

        <td > 
         <div id="port" style="padding-left:64px;">Please Explain: 
          <asp:TextBox ID="portdesc" runat="server" CssClass="textb" TextMode="MultiLine"></asp:TextBox> 
        </div> 
        </td> 
       </tr> 

       <tr><td style="padding-left:22px;">3.Please rate these</td> 

       </tr> 
       <tr> 
        <td style="padding-left:32px;">a.GUI</td> 

        <td> 

         <asp:Rating ID="Rating1" runat="server" BehaviorID="RatingBehavior1" CssClass="textb" 
           MaxRating="5" 
           StarCssClass="ratingStar" 
           WaitingStarCssClass="savedRatingStar1" 
           FilledStarCssClass="filledRatingStar1" 
           EmptyStarCssClass="emptyRatingStar1" 
           OnChanged="ThaiRating_Changed" 
           Style="float: left;" /> 

        </td> 


       </tr> 
       <tr> 
        <td style="padding-left:32px;">b.Correctness of content</td> 

        <td> 

         <asp:Rating ID="Rating2" runat="server" BehaviorID="RatingBehavior2" CssClass="textb" 
           MaxRating="5" 
           StarCssClass="ratingStar" 
           WaitingStarCssClass="savedRatingStar1" 
           FilledStarCssClass="filledRatingStar1" 
           EmptyStarCssClass="emptyRatingStar1" 
           OnChanged="ThaiRating_Changed" 
           Style="float: left;" /> 

        </td> 


       </tr> 
       <tr> 
        <td style="padding-left:32px;">c.Existing functionality</td> 

        <td> 

         <asp:Rating ID="Rating3" runat="server" BehaviorID="RatingBehavior3" CssClass="textb" 
           MaxRating="5" 
           StarCssClass="ratingStar" 
           WaitingStarCssClass="savedRatingStar1" 
           FilledStarCssClass="filledRatingStar1" 
           EmptyStarCssClass="emptyRatingStar1" 
           OnChanged="ThaiRating_Changed" 
           Style="float: left;" /> 

        </td> 


       </tr> 


       <tr><td style="padding-left:22px;">4.Please give a feedback</td></tr> 
       <tr> 
        <td style="padding-left:34px;"> 
         <asp:TextBox ID="msg" runat="server" CssClass="textb" TextMode="MultiLine"></asp:TextBox> 
        </td> 
       </tr> 
        <tr> 
        <td style="padding-left:22px;">5.Do you have any document/image/screenshot/slide for the new requirement reference? if yes,please upload(max 2MB)</td> 
        </tr> 
       <tr> 
        <td> 

         <asp:FileUpload ID="fileupload1" runat="server" CssClass="textb" onchange="validateFileSize();"/> 

         <asp:Label ID="lblMessage" Text="&nbsp;" runat="server" style="color:Red;"/> 
         <div id="dvMsg" style="color:Red; width:195px;display:none;" > 
       File size is greater than 2mb </div> 

        </td> 
       </tr> 

      </table> 
    <asp:Button ID="Button1" runat="server" OnClick="btnUpload_Click" Text="Save and Continue" CssClass="btn" AutoPostback = "false"/> 
     <%-- <asp:Button ID="Button4" runat="server" Text="Save and Continue" CssClass="btn" OnClick="Button4_Click" />--%> 
     </asp:Panel> 






     <%-- new requirements tab--%> 
     <asp:Panel ID="Panel2" runat="server"> 
      <div class="tabcaption">New requirements</div> 

      <table class="newrq"> 

       <tr> 
        <td style="padding-left:22px;"> 1.What are your new Requirements? Please Explain: </td> 
        </tr> 
         <tr> 
        <td style="padding-left:53px;"> 

         <asp:TextBox ID="newrequire" runat="server" CssClass="textb" TextMode="MultiLine" ></asp:TextBox> 

        </td> 

         </tr> 
       <tr> 
        <td style="padding-left:22px;">2.Do you require any new functions ?</td> 
         </tr> 
       <tr > 
        <td style="padding-left:28px;"> 
         <div id="RadioDiv"> 
       <asp:RadioButtonList ID="newfunc" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="radio1"> 

          <asp:ListItem Value="yes">Yes&nbsp;&nbsp;&nbsp;</asp:ListItem> 
          <asp:ListItem Value="no">No</asp:ListItem> 
         </asp:RadioButtonList> 
        </div> 
       </td> 
       </tr> 

       <tr > 
        <%-- <td style="padding-left:28px;width:200px;margin-left:-220px;">Functions List</td>--%> 
        <td> 
         <div id="fundiv" style="padding-left:64px;"> 
          Functions List: 
         <asp:DropDownList ID="funlist" runat="server"> 
           <asp:ListItem runat="server" Value="no">--Select--</asp:ListItem> 
          <asp:ListItem runat="server" Value="yes">Reports</asp:ListItem> 
          <asp:ListItem runat="server" Value="yes">Charts</asp:ListItem> 
          <asp:ListItem runat="server" Value="yes">Graphs</asp:ListItem> 
          <asp:ListItem runat="server" Value="yes">Analysis</asp:ListItem> 
           <asp:ListItem runat="server" Value="yes">Others</asp:ListItem> 
         </asp:DropDownList> 
         </div> 

        </td> 
       </tr> 
       <tr><%-- <td style="padding-left:28px;width:200px;margin-left:-220px;">Please Explain</td>--%> 
        <td> 
         <div id="expdiv" style="padding-left:64px;"> 
          Please Explain: 
          <asp:TextBox ID="fundesc" runat="server" CssClass="textb" TextMode="MultiLine"></asp:TextBox> 
          <a alt="Reports" class="tooltipDemo" href="#"> 
          <asp:Image ID="Image3" runat="server" Height="25px" ImageUrl="images/tooltip.jpg" style="margin-top: -49px;" Width="25px" /> 
          </a> 
         </div> 
        </td> 
       </tr> 
       <tr> 
        <td style="padding-left:22px;">3.What will be the input data for the requirement?</td> 
        </tr> 
       <tr> 
        <td style="width:385px;padding-left:53px;"> 

         <asp:TextBox ID="inpt" runat="server" CssClass="textb" TextMode="MultiLine"></asp:TextBox> 

        </td> 
       </tr> 
        <tr> 
        <td style="padding-left:22px;">4.What should be the output data for the requirement?</td> 
        </tr> 
       <tr> 
        <td style="width:385px;padding-left:53px;"> 

         <asp:TextBox ID="oupt" runat="server" CssClass="textb" TextMode="MultiLine"></asp:TextBox> 

        </td> 
       </tr> 
       <tr> 
        <td style="padding-left:22px;">5.Do you have any document/image/screenshot/slide for the new requirement reference? if yes,please upload(max 2MB)</td> 
        </tr> 
       <tr> 
        <td> 

         <asp:FileUpload ID="fileupload2" runat="server" CssClass="textb" onchange="validateFileSize1();"/> 
         <asp:Label ID="Label1" runat="server" ></asp:Label> 

        <div id="dvMsg1" style="color:Red; width:195px;display:none;" > 
       File size is greater than 2mb </div> 
        </td> 
       </tr> 

      </table> 

      <asp:Button ID="Button2" runat="server" Text="Save" onclick="btnUpload_Click1" CssClass="btn" /> 

     </asp:Panel> 


     <%-- My feedback tab--%> 
     <asp:Panel ID="Panel3" runat="server"> 

      <div class="tabcaption"> </div> 
      <div style="overflow:auto;">General Feedback 
      <asp:GridView ID="dataGridView2" runat="server" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White" 
     AutoGenerateColumns="true" OnPageIndexChanging="datagrid_PageIndexChangingimg"> 


      </asp:GridView></div> 
      <br /><br /> 
       <div style="overflow:auto;"> 
      New Requirements 
       <asp:GridView ID="dataGridView3" runat="server" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White" 
AutoGenerateColumns="true" OnPageIndexChanging="datagrid_PageIndexChangingimg1"> 

       </asp:GridView></div> 


     </asp:Panel> 

    </asp:Panel> 
        </ContentTemplate> 
       <Triggers> 
     <asp:AsyncPostBackTrigger ControlID="Button1" /> 
     </Triggers> 
       </asp:UpdatePanel> 
      </div> 

kgis.aspx.cs

btnUpload_Click protected void (expéditeur d'objet, EventArgs e) {

 MimeType m = new MimeType(); 
     HttpPostedFile file = fileupload1.PostedFile; 
     byte[] document = new byte[file.ContentLength]; 
     file.InputStream.Read(document, 0, file.ContentLength); 
     string s = m.GetMimeType(document, file.ToString()); 


     switch (Rating1.CurrentRating) 
     { 
      case 1: 
       remarks = "Poor"; 
       break; 
      case 2: 
       remarks = "Average"; 
       break; 
      case 3: 
       remarks = "Good"; 
       break; 
      case 4: 
       remarks = "Very Good"; 
       break; 
      case 5: 
       remarks = "Excellent"; 
       break; 
     } 

     switch (Rating2.CurrentRating) 
     { 
      case 1: 
       remarks = "Poor"; 
       break; 
      case 2: 
       remarks = "Average"; 
       break; 
      case 3: 
       remarks = "Good"; 
       break; 
      case 4: 
       remarks = "Very Good"; 
       break; 
      case 5: 
       remarks = "Excellent"; 
       break; 
     } 
     //string remarks2 = "[unknown]"; 
     switch (Rating3.CurrentRating) 
     { 
      case 1: 
       remarks = "Poor"; 
       break; 
      case 2: 
       remarks = "Average"; 
       break; 
      case 3: 
       remarks = "Good"; 
       break; 
      case 4: 
       remarks = "Very Good"; 
       break; 
      case 5: 
       remarks = "Excellent"; 
       break; 
     } 


     if (s.Equals("not valid file")) 
     { 

      // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('file is not valid')", true); 
      //Console.WriteLine("The variable is set to true."); 
      Label1.Text = "file is not valid"; 
     } 

     else 
     { 

      using (SqlConnection con = new SqlConnection(connectionString)) 
      { 
       using (SqlCommand cmd = new SqlCommand()) 
       { 



         con.Open(); 
         cmd.CommandText = "insert into FileInformation(usernm,emailID,info,infodesc,portal,portdesc,guirating,ccrating,efrating,feedback,FileName,FileType,FileData) values(@usernm,@emailID,@info,@infodesc,@portal,@portdesc,@guirating,@ccrating,@efrating,@feedback,@Name,@Type,@Data)"; 
         cmd.Parameters.AddWithValue("@usernm", usernm); 
         cmd.Parameters.AddWithValue("@emailID", emailID); 
         cmd.Parameters.AddWithValue("@info", radiolist1.SelectedItem.Value); 
         cmd.Parameters.AddWithValue("@infodesc", infodesc.Text); 
         cmd.Parameters.AddWithValue("@portal", RadioButtonList1.SelectedItem.Value); 
         cmd.Parameters.AddWithValue("@portdesc", portdesc.Text); 
         cmd.Parameters.AddWithValue("@guirating", remarks); 
         cmd.Parameters.AddWithValue("@ccrating", remarks); 
         cmd.Parameters.AddWithValue("@efrating", remarks); 
         cmd.Parameters.AddWithValue("@feedback", msg.Text); 
         cmd.Parameters.AddWithValue("@Name", file.FileName); 

         cmd.Parameters.AddWithValue("@Type", s); 
         cmd.Parameters.AddWithValue("@Data", document); 


         cmd.Connection = con; 
         cmd.ExecuteNonQuery(); 
         con.Close(); 
         // BindGridviewData(); 

         ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "javascript:alert('feedback recieved successfully')", true); 



       } 
      } 
     } 

     radiolist1.SelectedIndex = -1; 
     infodesc.Text = ""; 
     RadioButtonList1.SelectedIndex = -1; 
     portdesc.Text = ""; 
     msg.Text = ""; 
     Rating1.CurrentRating = 0; 
     Rating2.CurrentRating = 0; 
     Rating3.CurrentRating = 0; 
    } 

Répondre

0

Vous ne pouvez pas.

Preuve: http://www.telerik.com/forums/using-both-ajaxtoolkit-scriptmanager-and-telerikscriptmanager

Une réponse de l'équipe Telerik dit,

« En utilisant les deux auges de script (RadScriptManager et ToolkitScriptManager) ne sont pas pris en charge car vous pourriez avoir qu'un seul contrôle du gestionnaire de script sur la page Dans ce cas, il convient d'utiliser RadScriptManager et d'enregistrer manuellement les scripts nécessaires à AjaxToolKit. "

+0

merci captainsac – user2882173

+0

Vous êtes le bienvenue – captainsac