WEB页面内完全都是控件希望通过后台代码实现这个功能
拖入几个控件
<table style="width:97%; height: 4px;">
<tr>
<td class="style8">
名称:</td>
<td class="style16">
<asp:TextBox ID="TextBox1" runat="server" Width="148px"></asp:TextBox>
</td>
<td class="style14">
<asp:Button ID="Button1" runat="server" height="21px" onclick="Button1_Click"
style="margin-left: 0px" Text="添 加" width="78px" />
<asp:Button ID="Button7" runat="server" height="21px" onclick="Button7_Click"
Text="数据导出" width="78px" />
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label2" runat="server" Text="编号:" Visible="False"></asp:Label>
</td>
<td class="style17">
<asp:TextBox ID="TextBox2" runat="server" Enabled="False" Visible="False"
ontextchanged="TextBox2_TextChanged"></asp:TextBox>
</td>
<td class="style15">
<asp:Button ID="Button6" runat="server" height="21px" onclick="Button6_Click1"
Text="保存编辑" Visible="False" width="78px" />
<asp:Button ID="Button5" runat="server" height="21px" onclick="Button5_Click1"
Text="取消修改" Visible="False" width="78px" />
</td>
</tr>
</table>通过后台代码实现 点击添加 判断 TextBox1与TextBox2中数据都不为空 如果为空提示
希望能附带上讲解 刚刚介入ASP.NET项目开发
拖入几个控件
<table style="width:97%; height: 4px;">
<tr>
<td class="style8">
名称:</td>
<td class="style16">
<asp:TextBox ID="TextBox1" runat="server" Width="148px"></asp:TextBox>
</td>
<td class="style14">
<asp:Button ID="Button1" runat="server" height="21px" onclick="Button1_Click"
style="margin-left: 0px" Text="添 加" width="78px" />
<asp:Button ID="Button7" runat="server" height="21px" onclick="Button7_Click"
Text="数据导出" width="78px" />
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label2" runat="server" Text="编号:" Visible="False"></asp:Label>
</td>
<td class="style17">
<asp:TextBox ID="TextBox2" runat="server" Enabled="False" Visible="False"
ontextchanged="TextBox2_TextChanged"></asp:TextBox>
</td>
<td class="style15">
<asp:Button ID="Button6" runat="server" height="21px" onclick="Button6_Click1"
Text="保存编辑" Visible="False" width="78px" />
<asp:Button ID="Button5" runat="server" height="21px" onclick="Button5_Click1"
Text="取消修改" Visible="False" width="78px" />
</td>
</tr>
</table>通过后台代码实现 点击添加 判断 TextBox1与TextBox2中数据都不为空 如果为空提示
希望能附带上讲解 刚刚介入ASP.NET项目开发
解决方案 »
- GridView中TextBox中的问题 在线等!!!
- 老问题再提问,关于radionbutton
- 操作EXCEL的问题、、帮帮忙解决。。谢谢!
- 在codebehind文件中如何调用int32.Parse()函数?
- 网上银行卡转账(急)
- 有没有免费的livechart下载?
- 如何计算100000的阶乘,要求结果为精确值?如32330999,得到为3.233099*10 的n次方,又如何?
- 关于.net打印问题
- Web控件中有TreeView控件吗?
- 为什么我的C#的WebApplication放在在我的服务器上不能浏览,而本地就可以?
- 一个奇怪的问题
- 急!急! 在线等!!!Excel 导入SQL2005 报错“无法初始化链接服务器 "(null)" 的 OLE DB 访问接口...”
{Response.Write("不能为空");
}
else
{
执行正确操作
}
{
//
}
else
{
//
}
{Response.Write("不能为空");
return;
}
else
{
执行正确操作
}
{
Page.ClientScript.RegisterStartupScript(GetType(), "sf", "<script language='javascript'>alert('系统提示:\\n姓名不能空!');document.all('TextBox1').focus()</script>");
}
else
{
//执行代码...
}
{ if(string.IsNullOrEmpty(TextBox1.Text))
{ Page.ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript'>alert('系统提示:\\n添加名称不能空!');document.all('TextBox1').focus()</script>");
return;
} if (string.IsNullOrEmpty(TextBox2.Text))
{ Page.ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript'>alert('系统提示:\\n添加编号不能空!');document.all('TextBox2').focus()</script>");
return; }
else
{
NewMethod();
}
} private void NewMethod()
{
CTWebPlatform.localhost.CTWebInterface mWebInt = new CTWebInterface();
if (TextBox1.Text.Trim() != "")
{
mWebInt.AddMeasureStation(TextBox1.Text.Trim());
GridView1.PageIndex = GridView1.PageCount;
DataBinds();
}
}
public void DataBinds( )
{
CTWebPlatform.localhost.CTWebInterface mWebInt = new CTWebInterface();
DataTable BindData = mWebInt.SelMeasureStation();
GridView1.DataSource = BindData.DefaultView;
GridView1.DataBind();
}
{
Response.Write("<SCRIPT language=JavaScript>alert('不能为空! ');");
Response.Write("javascript:history.back(1)</SCRIPT>");
Response.End();
return;
}
else
{
//验证正确执行操作代码
}