我有一个包含表单的Bootstrap Modal.Modal还包含,提交和取消按钮.现在根据我的要求,在提交按钮单击模态,表单正在成功提交但模态未关闭..这是我的HTML ..
<div class="modal fade" id="StudentModal" tabindex="-1" role="dialog" aria-labelledby="StudentModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<form action="~/GetStudent" class="form-horizontal" role="form" method="post" id="frmStudent">
<div class="modal-footer">
<div class="pull-right">
<button type="submit" class="btn btn-success"><i class="glyphicon glyphicon-ok"></i> Save</button>
<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="glyphicon glyphicon-remove"></i> Close</button>
</div>
</div>
</form>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
怎么做..请帮帮我..谢谢..
我正在尝试更新 TypeScript 中接口之一的部分属性,如下所示
interface details{
name: string,
phonenumber: number,
IsActive: boolean
}
let pDt: Partial<details> = {IsActive: false};
Run Code Online (Sandbox Code Playgroud)
当我试图将其作为参数的方法之一传递给它时details,它给出了以下问题“ Partial 类型的参数不可分配给‘detail’类型的参数”。
这里出了什么问题以及如何纠正?
我设计了Razor Syntax的电子邮件模板.当我使用C#代码和SMTP协议将此模板作为电子邮件发送时,我将裸露的Razor和HTML标记作为电子邮件正文.这种方法我错了吗?Razor页面是否允许作为电子邮件模板?
这是我的页面
@inherits ViewPage
@{
Layout = "_Layout";
ViewBag.Title = "";
}
<div class="container w-420 p-15 bg-white mt-40">
<div style="border-top:3px solid #22BCE5"> </div>
<span style="font-family:Arial;font-size:10pt">
Hello <b>{UserName}</b>,<br /><br />
Thanks for Registering to XYZ Portal<br /><br />
<a style="color:#22BCE5" href="{Url}">Click to Confirm Email</a><br />
<br /><br />
Thanks<br />
Admin (XYZ)
</span>
Run Code Online (Sandbox Code Playgroud)
更新..
using (StreamReader reader = new StreamReader(HttpContext.Current.Server.MapPath("~/ContentPages/EmailConfTemplate.cshtml")))
{
body = reader.ReadToEnd();
//Replace UserName and Other variables available in body Stream
body = body.Replace("{UserName}", FirstName);
}
Run Code Online (Sandbox Code Playgroud)
稍后我在将SMTP代码替换为..
MailMessage message …Run Code Online (Sandbox Code Playgroud) 我有一个材料 ui 小吃栏,我需要将其显示在屏幕中间。下面是我试图传递的属性,使其显示在屏幕中心,但显示在屏幕顶部。
anchorOrigin={{
vertical: "center",
horizontal: "center"
}}
Run Code Online (Sandbox Code Playgroud)
https://codesandbox.io/s/snackbar-background-color-f37po是展示该问题的示例。这是怎么回事?
我正在实施材料 UI“选择”,其值来自后端。下面是我的代码
<FormControl variant="outlined" className={classes.formControl}>
<InputLabel ref={inputLabel} id="demo-simple-select-outlined-label" htmlFor="outlined-Name">
Name
</InputLabel>
<Select
value={Name}
onChange={handleChange}
labelWidth={labelWidth}
inputProps={{
name: 'Name',
id: 'outlined-Name',
}}
>
<MenuItem value="1" className={classes.menuItm}>All</MenuItem>
{
NameArr.data.map(Name => (
<MenuItem value={Name.name} className={classes.menuItm}>{Name.name}</MenuItem>
))
}
</Select>
</FormControl>
Run Code Online (Sandbox Code Playgroud)
以下代码的问题variant="outlined"是没有得到应用。根据此处的演示
,我看不到应该存在的轮廓/边框https://codesandbox.io/s/material-demo-9jyoj我的代码有什么问题?
我使用 Material UI 创建了一个 React 组件,如下所示
<Popper
open={open}
anchorEl={anchorRef.current}
onBlur={handleToggle}
transition
disablePortal
>
<MenuList autoFocusItem={open}>
<MenuItem>Tom</MenuItem>
<MenuItem>Patt</MenuItem>
</MenuList>
<input type="text" name="Student" onChange={getStudent}></input>
</Popper>
Run Code Online (Sandbox Code Playgroud)
在上面的组件中我有MenuList和TextField。我尝试添加 onBlur={handleToggle}这样的想法,如果在组件外部单击,它将关闭组件,但即使我尝试在TextFieldusing中添加文本onChange={getStudent},它也会关闭,为什么会发生这种情况以及如何仅在组件外部单击时关闭组件?谢谢。
我正在优化我的反应应用程序包。当前大小为 1.4MB。在路由器中实现延迟加载。在本地主机上运行应用程序时,我可以看到延迟加载在浏览器的“网络”选项卡中运行良好,我在浏览器中看到第一个初始块加载和渲染,然后是 1.4MB 的其余部分。当我创建一个生产包并将其部署到服务器时,问题出现了,加载了整个 1.4MB,然后可以看到渲染。
生产包创建过程中是否缺少某些内容?如何检查服务器上的延迟加载是否有效?
Webpack.config.js
const path = require('path');
const { resolve } = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
var CompressionPlugin = require('compression-webpack-plugin');
process.env.BABEL_ENV = 'production';
process.env.NODE_ENV = 'production';
module.exports = {
devtool: 'cheap-module-source-map',
entry: './src/index.jsx',
resolve: {
fallback: { crypto: false },
extensions: ['.js', '.jsx', '.json', '.wasm'],
enforceExtension: false,
alias: {
process: resolve('node_modules/process')
}
},
devServer: {
historyApiFallback: true,
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/' …Run Code Online (Sandbox Code Playgroud) 我有一个C#模型类,我试图访问一个.cshtml应该是电子邮件格式模板的页面.我正在使用以下代码:
string body = string.Empty;
using (StreamReader reader = new StreamReader(Server.MapPath("~/EmailConfTemplate.cshtml")))
{
body = reader.ReadToEnd();
}
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误消息:
名称Server在当前上下文中不存在
代码中是否有任何错误,或者Server在POCO类中无法访问类.请帮忙.
我已经在 C# 中生成了 6 位字母数字文本,现在我需要将其显示为图像。为此,我 在 .Net 中使用Bitmapand 。Graphics
因此,我能够获取图像,但我需要对图像的字体进行一些小的更改,就像我们在验证码挑战锯齿形中看到的那样,使其有点难以阅读。
这是我的代码...
Bitmap bmp = new Bitmap(100, 30);
Graphics g = Graphics.FromImage(bmp);
g.Clear(Color.Navy);
string randomString = CaptchaImageResult.GetCaptchaString(6);
g.DrawString(randomString, new Font("Courier", 16),
new SolidBrush(Color.WhiteSmoke), 2, 2);
HttpResponse response = System.Web.HttpContext.Current.Response;
response.ContentType = "image/jpeg";
bmp.Save(response.OutputStream, ImageFormat.Jpeg);
bmp.Dispose();
new CaptchaChallenge { Captcha = bmp };
Run Code Online (Sandbox Code Playgroud)
更新..
我尝试使用此代码,但字母不清晰..
Brush zigzagBrush = new System.Drawing.Drawing2D.HatchBrush(
System.Drawing.Drawing2D.HatchStyle.ZigZag, Color.White);
g.DrawString(randomString, new Font("Courier", 16), zigzagBrush, 2, 2);
Run Code Online (Sandbox Code Playgroud) 我有一个包含表格的Bootstrap Modal.Modal还包含提交和取消按钮.取消按钮工作正常,它正在成功关闭模态.现在按照我对提交按钮的要求,通过将用户输入传递给Web服务来单击模板正在成功提交的模式,但Modal没有关闭.此外,我只需要在"提交"按钮单击事件上重新加载页面.这是我的HTML ..
<div class="modal fade" id="StudentModal" tabindex="-1" role="dialog" aria-labelledby="StudentModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<form action="~/GetStudent" class="form-horizontal" role="form" method="post" id="frmStudent">
<div class="modal-footer">
<div class="pull-right">
<button type="submit" class="btn btn-success"><i class="glyphicon glyphicon-ok"></i> Save</button>
<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="glyphicon glyphicon-remove"></i> Close</button>
</div>
</div>
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
我尝试了以下关闭模态的方法..
$('#frmStudent').submit(function() {
$('#StudentModal').modal('hide');
return false;
});
Run Code Online (Sandbox Code Playgroud)
根据我的要求,我需要关闭提交事件上的模态,并在从Web服务返回后重新加载页面.我怎么能用Jquery做到这一点?
注意:我不应该在这里使用Ajax Call ..我只需要从表单操作提交表单
reactjs ×5
javascript ×4
.net ×3
c# ×3
html ×3
css ×2
forms ×2
jquery ×2
material-ui ×2
bundle ×1
captcha ×1
drawing ×1
email ×1
image ×1
lazy-loading ×1
razor ×1
select ×1
typescript ×1
webpack ×1