2012-03-31 11 views
0

ハンドラから.aspx fleの要素のいずれかにcssを追加することができます。asp.netハンドラでCSSを追加する

これは私のハンドラである:

Private Sub UploadWholeFile(ByVal context As HttpContext, ByVal statuses As List(Of FilesStatus)) 
     For i As Integer = 0 To context.Request.Files.Count - 1 
      Dim file = context.Request.Files(i) 
      file.SaveAs(ingestPath & Path.GetFileName(file.FileName)) 
      Thread.Sleep(1000) 
      Dim fname = Path.GetFileName(file.FileName) 
      statuses.Add(New FilesStatus With {.thumbnail_url = "Thumbnail.ashx?f=" & fname, .url = "Upload.ashx?f=" & fname, .name = fname, .size = file.ContentLength, .type = "image/png", .delete_url = "Upload.ashx?f=" & fname, .delete_type = "DELETE", .progress = "1.0"}) 
     Next i 
    End Sub 

そして、私は以下の通り私のDefault.aspxページにテンプレートファイルに実際にあるボタンを持っている:

<script id="template-upload" type="text/x-tmpl"> 
{% for (var i=0, file; file=o.files[i]; i++) { %} 
    <tr class="template-upload fade"> 
    <td><img src="img/paperclip.png"/></td> 
     <td class="imagename"><span>{%=file.name%}</span></td> 
     {% if (file.error) { %} 
      <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td> 
     {% } else if (o.files.valid && !i) { %} 

      <td class="start" style="visibility:hidden">{% if (!o.options.autoUpload) { %} 
       <button class="btn btn-primary"> 
        <i class="icon-upload icon-white"></i> 
        <span>{%=locale.fileupload.start%}</span> 
       </button> 
      {% } %}</td> 
     {% } else { %} 
      <td colspan="2"></td> 
     {% } %} 
     <td class="cancel">{% if (!i) { %} 
      <button class="btn btn-warning"> 
       <i class="icon-ban-circle icon-white"></i> 
      </button> 
     {% } %}</td> 
    </tr> 
{% } %} 
</script> 

今、私が変更したいですイメージするボタン。 それでは、ハンドラからどうすればいいですか?

私はbtn-warning

<button type="submit" class="btn btn-primary start"> 
        <i class="icon-upload icon-white"></i> 
        <span>Start upload</span> 
</button> 

答えて

2

のアイコンを変更する必要があり、下のボタンをクリックした場合は、画像のクライアント側にあるボタンを変更した場合には、ユーザーがそれをクリックしたときに、容易になるだろう。あなたのreply.Mayためのおかげで私は1つのボタンの2回のbuttons.Onクリックを持っているあなたをright.Butしていることがmsigman、まず@

<button class="btn btn-primary" onclick="changeToImage();"> 

function changeToImage() 
{ 
    $('.btn-warning').replaceWith('<img src="/wherever.jpg"/>'); 
} 

Swap button for image (Jquery)

+0

を(それはあなたが後にしているものを本当にだように見えます)私はotherを変更する必要があります。私はこの場合どのように変更するのですか? – coder

+0

私は代わりにbtn警告ボタンを置き換えるために私の答えを更新しました。 – msigman

+0

@ msigman - ありがとうございました。乾杯:) – coder

関連する問題