Dropzone和asp元素

时间:2017-06-09 18:45:53

标签: asp.net webforms dropzone.js runatserver

我是asp.net的新开发者,发现了一个我无法解决的问题。 我的.aspx如下所示:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="menu" style="margin: 0px; background-color:transparent; border: 0px solid ##000; width: 65%;">
  <tr>
    <td style="padding: 1px 2px 1px 0px; font-size:12px;"><a data-chart="chart1" href="##">CHART ONE</a></td>
    <td style="padding: 1px 8px; 1px 0px; font-size:12px;"><a data-chart="chart2" href="##">CHART TWO</td>
    			  <td style="padding: 1px 2px; 1px 0px; font-size:12px;"><a data-chart="chart3" href="##">CHART THREE</td>
    				</tr>	
    				</td>
    				</table>
    				
    				<div id="charts">
    <div id="chart1" class="chart" data-chart="chart1">
        <table class="tbl" style="background-color: ##fff;">
    				
					<tr>
						<th>Chart One</th>
						<th>Header</th>
						<th>Header</th>
						<th>Header</th>
					</tr>
					<tr style="background-color: ##959595;">
						<td style="background-color: ##4e4f4f;">Text</td>
						<td class="x">&nbsp;</td>
						<td class="x">&nbsp;</td>
						<td class="x">Text</td>
					</tr>
					<tr style="background-color: ##aaa;">
						<td style="background-color: ##767777;">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
					</tr>
					<tr style="background-color: ##959595;">
						<td style="background-color: ##4e4f4f;">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
        </table>
    </div>
    <div id="chart2" class="chart hide" data-chart="chart2">
        <table class="tbl" style="background-color: ##fff;">
    				
					<tr>
						<th>Chart Two</th>
						<th>Header</th>
						<th>Header</th>
						<th>Header</th>
					</tr>
					<tr style="background-color: ##959595;">
						<td style="background-color: ##4e4f4f;">Text</td>
						<td class="x">&nbsp;</td>
						<td class="x">&nbsp;</td>
						<td class="x">Text</td>
					</tr>
					<tr style="background-color: ##aaa;">
						<td style="background-color: ##767777;">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
					</tr>
					<tr style="background-color: ##959595;">
						<td style="background-color: ##4e4f4f;">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
        </table>
    </div>
    <div id="chart3" class="chart hide" data-chart="chart3">
        <table class="tbl" style="background-color: ##fff;">
    				
					<tr>
						<th>Chart Three</th>
						<th>Header</th>
						<th>Header</th>
						<th>Header</th>
					</tr>
					<tr style="background-color: ##959595;">
						<td style="background-color: ##4e4f4f;">Text</td>
						<td class="x">&nbsp;</td>
						<td class="x">&nbsp;</td>
						<td class="x">Text</td>
					</tr>
					<tr style="background-color: ##aaa;">
						<td style="background-color: ##767777;">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
					</tr>
					<tr style="background-color: ##959595;">
						<td style="background-color: ##4e4f4f;">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
						<td class="x">Text</td>
        </table>

正如你所看到的,我有一个下拉列表,我将在page_load上填充一个dropzone(我需要这样)。

extension UITextField {
    func border(position: CGFloat) {
    let leftBorder = CALayer()
    leftBorder.frame = CGRect(x: CGFloat(0.0), y: CGFloat(0.0), width: CGFloat(1.0), height: CGFloat(self.frame.size.height))
    leftBorder.backgroundColor = UIColor.black.cgColor
    self.layer.addSublayer(leftBorder)
    let rightBorder = CALayer()
    rightBorder.frame = CGRect(x: CGFloat(self.frame.size.width - 1), y: CGFloat(0.0), width: CGFloat(1.0), height: CGFloat(self.frame.size.height))
    rightBorder.backgroundColor = UIColor.black.cgColor
    self.layer.addSublayer(rightBorder)
    let bottomBorder = CALayer()
    bottomBorder.frame = CGRect(x: CGFloat(0.0), y: CGFloat(self.frame.size.height - 1), width: CGFloat(self.frame.size.width), height: CGFloat(1.0))
    bottomBorder.backgroundColor = UIColor.black.cgColor
    self.layer.addSublayer(bottomBorder)
    let topBorder = CALayer()
    topBorder.frame = CGRect(x: CGFloat(0.0), y: CGFloat(0.0), width: CGFloat(25.0), height: CGFloat(1.0))
    topBorder.backgroundColor = UIColor.black.cgColor
    self.layer.addSublayer(topBorder)
    let width = CGFloat(self.frame.size.width - position)
    let topBorder2 = CALayer()
    topBorder2.frame = CGRect(x: position, y: CGFloat(0), width: width, height: CGFloat(1.0))
    topBorder2.backgroundColor = UIColor.black.cgColor
    self.layer.addSublayer(topBorder2)
}

这是使div像dropzone一样的脚本,但我不确定url是否正确。 在page_load部分出现问题,因为我需要在页面加载时填充下拉列表, 当我尝试通过dropzone上传文件时,它将作为回发发送并输入&#39; if&#39;然后重新填充组合框,重置所选的值。

<form action="#" class="" runat="server" >
    <asp:DropDownList ID="ddlCombo" runat="server">
    </asp:DropDownList>
</form>

<div class="clsbox-1" runat="server">
    <div class="dropzone clsbox" id="mydropzone">
    </div>
</div>

如果有任何奇特的方法可以告诉我,因为我无法弄明白!

修改 我不明白为什么如果我在表格中发送它按预期工作:

<script>
Dropzone.autoDiscover = false;
$("#mydropzone").dropzone({
    url: "WebForm1.aspx?param=1",
    addRemoveLinks: true,
    maxFilesize: 0.5,
    dictDefaultMessage: 'drag and drop',
    dictResponseError: 'Error uploading file!'
});
<script>

当我在此处上传文件时,它不会作为回复发送。 求求你!

1 个答案:

答案 0 :(得分:1)

您的dropzone url参数应该是您创建的另一个页面/ httphandler / controller,以接受上传并将其保存到文件(或者您想用它做什么)。您可以在技术上使用您当前使用的页面,但在您的情况下它会有点棘手,因为您需要检测导致回发和处理的页面(即不要重置下拉列表)。

我建议使用HttpHandler而不是普通页面来接收文件。这是example的一个。

相关问题