我正在使用Html.Label在我的MVC applilcation中显示一些数据.当我尝试显示电子邮件地址时,它无法正常呈现
Model.CopyToEmail = lab@gmail.com
@Html.Label((string)(Model.CopyToEmail))
Run Code Online (Sandbox Code Playgroud)
但我看到的渲染输出是
com
Run Code Online (Sandbox Code Playgroud)
任何人都可以建议如何使用Html.Label显示
lab@gmail.com
Run Code Online (Sandbox Code Playgroud) 我有一个将在运行时生成的位图图像。我没有它的本地 url,因为它是在运行时以这种方式生成并返回给我的。有没有办法在运行时将此图像添加到 cshtml 文件或 html 文件?
public Bitmap GetBarcodeImage(string inputString)
{
Bitmap bitmap = new Bitmap(200,100);
Graphics graphics = Graphics.FromImage(bitmap);
graphics.Clear(Color.White);
graphics.DrawString(inputString, new Font("Free 3 of 9",60,FontStyle.Regular), Brushes.Black, new PointF(0, 0));
return bitmap;
}
Run Code Online (Sandbox Code Playgroud) 我一直试图找到这个解决方案,但无法在线找到相关答案.
我有一堆文本框需要填充数据,例如在我的案例地址中.我有一个绑定到枚举的组合框,并有一个值列表可供选择
家,办公室,MainOffice,实验室.当我在组合框上做出选择时,我需要在下面的文本框中填充其地址.我可以从对象X获取Home地址,从Object Y获取Office地址,从Z获取MainOffice.如何使用组合框选择来执行此条件数据绑定.请指教.
这些是我可以选择的选项
public enum MailToOptions
{
Home,
Office,
CorporateOffice,
Laboratory,
}
<!-- Row 1 -->
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Content="Mail To:" />
<ComboBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="5" Name="MailToComboBox"
ItemsSource="{Binding Source={StaticResource odp}}"
SelectionChanged="HandleMailToSelectionChangedEvent" >
</ComboBox>
<!-- Agency ID -->
<!-- Name -->
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="5" Content="Name" />
<TextBox Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="5">
<TextBox.Text>
<Binding Path="Order.Agency.PartyFullName" Mode="TwoWay" />
</TextBox.Text>
</TextBox>
<!-- Row 2 -->
<!-- Address Line 1 -->
<Label Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="5" Content="Address 1" />
<TextBox Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="5"> …Run Code Online (Sandbox Code Playgroud) asp.net-mvc ×2
asp.net ×1
barcode ×1
bitmap ×1
combobox ×1
conditional ×1
data-binding ×1
html.label ×1
razor ×1
textbox ×1
wpf ×1