Image.Visible总是假的 [英] Image.Visible is always false
本文介绍了Image.Visible总是假的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
page.aspx.cs
imgUpAdd.visibl默认为true
protected void Page_Load( object sender,EventArgs e)
{
Page.Form.Attributes.Add( enctype, multipart / form-data);
}
受保护 void btnUpdate_Click( object sender,EventArgs e)
{
txtCatNum.Text = Grid.SelectedRow.Cells [< span class =code-digit> 1 ]。文字;
txtCantName.Text = Grid.SelectedRow.Cells [ 2 ]。文字;
txtDescription.Text = Grid.SelectedRow.Cells [ 3 ]。文字;
txtCatNum.ReadOnly = true ;
ImgUPAdd.Visible = true ;
ImgUPAdd.ImageUrl = ../../ CatImgs + txtCatNum.Text + < span class =code-string> jpg;
MultiView1.ActiveViewIndex = 1 ;
}
受保护 void btnAdd_Click( object sender,EventArgs e)
{
MultiView1.ActiveViewIndex = 1 ;
txtCantName.Text = ;
txtCatNum.Text = ;
txtDescription.Text = ;
ImgUPAdd.Visible = false ;
txtCatNum.ReadOnly = false ;
txtCatNum.Text = Cat.GetNextCatNo();
}
编辑AL:来自评论
page.aspx
< asp:ScriptManager ID = ScriptManager1 runat = < span class =code-keyword> server >
< ; asp:UpdatePanel ID = UpdatePanel1 runat = server >
< 触发器 >
< asp:PostBackTrigger ControlID = btnSave / >
< / Triggers > ;
< br / >
< asp:MultiView ID = MultiView1 runat = server ActiveViewIndex = 0 >
< br / >
< asp:查看 ID = View1 runat = 服务器 >
< 表 对齐 = center cellpadding = 3 cellspacing = 4 class = style1 dir = ltr >
< tr >
< span class =code-keyword>< td class = style3 >
< asp:Label ID = Label1 runat = server 字体名称 = 影响 字体大小 = 大
< span class =code-attribute>
文字 = 搜索产品类别 >
< / td >
< / tr >
< tr >
< td class = style3 >
< asp:标签 ID = Label2 runat = 服务器 字体名称 = 影响 字体大小 = 大
样式 = text -align:left 文字 = 搜索方式: >
< asp:RadioButtonList ID = rdoField runat = server RepeatDirection = 水平 >
< asp:ListItem 已选择 = True 值 = CatNo > ; 类别编号
< asp:ListItem 值 = CatName > 类别名称
< / td >
< < span class =code-leadattribute> / tr >
< tr >
< td class = style3 >
< asp:Label ID = Label3 runat = server 字体名称 = 影响 字体大小 = 大
文字 = 要搜索的值 >
< asp:TextBox ID = TxtSearch runat = server >
< asp:按钮 ID = BtnSearch runat = server 高度 = 33px 文本 = 搜索
宽度 = 85px onclick = BtnSearch_Click / >
< / td >
< / tr >
< tr >
< td class = style3 >
< asp:按钮 ID = btnAdd runat = server onclick = btnAdd_Click 文字 = 添加项 / >
< asp:按钮 ID = btnUpdate runat = server 已启用 = False 文本 = 更新 < span class =code-attribute>
< span class =code-attribute> onclick = btnUpdate_Click / >
< asp:按钮 ID = BtnRemove runat = 服务r 已启用 = False
< span class =code-attribute>
style = text-align:right 文字 = 删除 onclick = BtnRemove_Click / >
< ; / td >
< / tr >
< tr >
< td class = style3 >
< asp:Label ID = LblMessage runat = 服务器 ForeColor = #CC3300 >
< / td >
解决方案
嗨BasmaSH,
对于USP:像
< ASP:图片ID =myImageVisibile =TrueImgUrl =linkrunat =server>
它的工作方式与默认值相同。
您还可以使用在运行时代码背后也是
i希望对你有所帮助
谢谢
Uttam katariya
page.aspx.cs
imgUpAdd.visibl is true by default
protected void Page_Load(object sender, EventArgs e)
{
Page.Form.Attributes.Add("enctype", "multipart/form-data");
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
txtCatNum.Text=Grid.SelectedRow.Cells[1].Text;
txtCantName.Text = Grid.SelectedRow.Cells[2].Text;
txtDescription.Text = Grid.SelectedRow.Cells[3].Text;
txtCatNum.ReadOnly = true;
ImgUPAdd.Visible = true;
ImgUPAdd.ImageUrl = "../../CatImgs"+txtCatNum.Text+"jpg";
MultiView1.ActiveViewIndex = 1;
}
protected void btnAdd_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 1;
txtCantName.Text = "";
txtCatNum.Text = "";
txtDescription.Text = "";
ImgUPAdd.Visible = false;
txtCatNum.ReadOnly = false;
txtCatNum.Text = Cat.GetNextCatNo();
}
EDIT AL: From Comments
page.aspx
<asp:ScriptManager ID="ScriptManager1" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="btnSave" />
</Triggers>
<br />
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<br />
<asp:View ID="View1" runat="server">
<table align="center" cellpadding="3" cellspacing="4" class="style1" dir="ltr">
<tr>
<td class="style3">
<asp:Label ID="Label1" runat="server" Font-Names="Impact" Font-Size="Large"
Text="Search Products Categories">
</td>
</tr>
<tr>
<td class="style3">
<asp:Label ID="Label2" runat="server" Font-Names="Impact" Font-Size="Large"
style="text-align: left" Text="search by:">
<asp:RadioButtonList ID="rdoField" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Selected="True" Value="CatNo">Category Number
<asp:ListItem Value="CatName">Category Name
</td>
</tr>
<tr>
<td class="style3">
<asp:Label ID="Label3" runat="server" Font-Names="Impact" Font-Size="Large"
Text="Value to Search">
<asp:TextBox ID="TxtSearch" runat="server">
<asp:Button ID="BtnSearch" runat="server" Height="33px" Text="Search"
Width="85px" onclick="BtnSearch_Click" />
</td>
</tr>
<tr>
<td class="style3">
<asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" Text="Add Item" />
<asp:Button ID="btnUpdate" runat="server" Enabled="False" Text="Update"
onclick="btnUpdate_Click" />
<asp:Button ID="BtnRemove" runat="server" Enabled="False"
style="text-align: right" Text="Remove " onclick="BtnRemove_Click" />
</td>
</tr>
<tr>
<td class="style3">
<asp:Label ID="LblMessage" runat="server" ForeColor="#CC3300">
</td>
解决方案
Hi BasmaSH,
For USP:Image like
<ASP:Image id="myImage" Visibile="True" ImgUrl="link" runat="server">
it's work like default true.
and you can also visibility false by using in code behind on run time also
i hope it's help full to you
thanks
Uttam katariya
这篇关于Image.Visible总是假的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文