aspx 페이지의 업데이트 패널을 사용하여 버튼 클릭 이벤트 이후 페이지 새로 고침을 피하려고했지만 코드에서 Ajax 등급 컨트롤을 사용했습니다. ToolkitScriptManager를 사용했지만 업데이트 패널의 경우 scriptmanager의 표시 오류가 " ScriptManager를 페이지에 추가 할 수 있습니다. "with aout ajaxtoolkit rating wont work.Please 누군가 나에게이 문제를 극복 할 수있는 방법과 buttonclick 후 페이지 새로 고침을 피하는 방법을 제안 할 수 있습니다. 내 코드 : kgis.aspx단일 aspx 페이지에서 scriptmanger와 ajaxtoolscript manager를 모두 사용하는 방법은 무엇입니까?
<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 </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 </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=" " 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 </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 (개체 보낸 사람, EventArgs입니다 전자) { 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;
}
감사합니다. captainsac – user2882173
환영합니다 – captainsac