2012-09-03 135 views
0

您好所有即時試圖做的是使用圖像而不是按鈕的值傳遞給該控制器。 我得到它使用按鈕與工作。圖像按鈕ASP.NET

<input type="submit" name="Vote" value="1" /> 

這可以工作,但當我嘗試使用按鈕類型時失敗,說im發送一個空參數。

<input type="image" src="imagepath" value="1" alt="1" name="Vote" /> 

如果有人能幫助它將是一個偉大的感謝。

+0

您無法在input type ='image'元素上設置值。它將始終將光標的座標作爲值發送。 – ZippyV

回答

0
<input type="image" src="imagepath" value="1" alt="1" name="Vote" onclick="submit" /> 

但我想你會失去提交按下輸入鍵。

輸入圖像「有時」(?)只發送x和圖像y座標......

Input type="image"反正東西,以避免提交按鈕。

0

爲什麼不使用Ajax?

@Ajax.RawActionLink("Text", "Action", "Controller", null, ajaxOptions, new { @class = "button green small" })