我在DataGrid里加入模板列:
<asp:DataGrid ID="DataGrid1" CellPadding="1" ShowHeader="false" AutoGenerateColumns="false" BorderWidth="0" OnItemCommand="DataGrid1_ItemCommand" runat="server">
<columns>
<asp:TemplateColumn>
<itemtemplate>
<table width="65%" height="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="body2">
<tr height="28px">
<td width="200" align="right" bgcolor="#9999CC">注册名称:</td>
<td bgcolor="#CCCCFF">
<%# DataBinder.Eval(Container.DataItem,"Cl_RegID").ToString() %></td>
</tr>
<tr height="28px">
<td align="right" bgcolor="#9999CC">客户地址:</td>
<td bgcolor="#CCCCFF">
<asp:TextBox ID="Cl_Address" Text='<%# DataBinder.Eval (Container.DataItem,"Cl_Address").ToString() %>' runat="server"/></td>
</tr>
<tr height="28px">
<td align="right" bgcolor="#9999CC">客户官方网址:</td>
<td bgcolor="#CCCCFF">
<asp:TextBox ID="Cl_WebAddr" Text='<%# DataBinder.Eval(Container.DataItem,"Cl_WebAddr").ToString() %>' runat="server"/></td>
</tr>
.
.
.
.
</table>
</itemtemplate>
</asp:TemplateColumn>
</columns>
</asp:DataGrid>
再在取出页面DataGrid中TextBox的数据:
string Cl_Address = ((TextBox)e.Item.Cells[0].Controls[0]).Text;
string Cl_Webaddr = ((TextBox)e.Item.Cells[0].Controls[1]).Text;
int Cl_Postalcode = Int32.Parse(((TextBox)e.Item.Cells[0].Controls[2]).Text);
运行说转换类别无效...请教!
哪位大侠能指教这类所有的转换方法吗?谢谢~~~~~~
<asp:DataGrid ID="DataGrid1" CellPadding="1" ShowHeader="false" AutoGenerateColumns="false" BorderWidth="0" OnItemCommand="DataGrid1_ItemCommand" runat="server">
<columns>
<asp:TemplateColumn>
<itemtemplate>
<table width="65%" height="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="body2">
<tr height="28px">
<td width="200" align="right" bgcolor="#9999CC">注册名称:</td>
<td bgcolor="#CCCCFF">
<%# DataBinder.Eval(Container.DataItem,"Cl_RegID").ToString() %></td>
</tr>
<tr height="28px">
<td align="right" bgcolor="#9999CC">客户地址:</td>
<td bgcolor="#CCCCFF">
<asp:TextBox ID="Cl_Address" Text='<%# DataBinder.Eval (Container.DataItem,"Cl_Address").ToString() %>' runat="server"/></td>
</tr>
<tr height="28px">
<td align="right" bgcolor="#9999CC">客户官方网址:</td>
<td bgcolor="#CCCCFF">
<asp:TextBox ID="Cl_WebAddr" Text='<%# DataBinder.Eval(Container.DataItem,"Cl_WebAddr").ToString() %>' runat="server"/></td>
</tr>
.
.
.
.
</table>
</itemtemplate>
</asp:TemplateColumn>
</columns>
</asp:DataGrid>
再在取出页面DataGrid中TextBox的数据:
string Cl_Address = ((TextBox)e.Item.Cells[0].Controls[0]).Text;
string Cl_Webaddr = ((TextBox)e.Item.Cells[0].Controls[1]).Text;
int Cl_Postalcode = Int32.Parse(((TextBox)e.Item.Cells[0].Controls[2]).Text);
运行说转换类别无效...请教!
哪位大侠能指教这类所有的转换方法吗?谢谢~~~~~~
解决方案 »
- c#图片压缩问题
- 输出的HTML标签过多,倒致IE8很卡,如何解决?
- 技术实践和理论知识
- asp.net魔兽分析
- 继续发贴,根据输入IP地址获取MAC地址(c#)
- 想学WebPart有什么好的教程?
- 我在Windows2000 Server 机子上装好了Visual Studio .net 2003现在再安装一套 Visual Studio 6.0 企业版,会不会对以前的 Visual Studio.
- 一个web.config异常,我都快昏了,望各位大虾帮忙!
- 高手进来帮帮忙哦.
- 我提议,社区英雄评选(前50位up有分!)
- 不能将数据插入数据库,请大家帮忙!
- 高分请教asp.net页面应用css的问题
string Cl_Address =t1.Text;