asp.net综合类B2B市场的设计与实现 第9页
OnClick="Button2_Click" /></asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:Panel>
</asp:TableCell>
<asp:TableCell>
<asp:Panel ID="Panel2" runat="server" Height="500px" Width="50px">
</asp:Panel>
</asp:TableCell>
<asp:TableCell>
<asp:Panel ID="Panel5" runat="server" Height="500px" Width="500px">
<asp:Table ID="Table2" runat="server" Height="" Width="500px">
<asp:TableRow>
<asp:TableCell>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatLayout="Flow" RepeatColumns="2"
OnSelectedIndexChanged="RadioButtonList1_SelectedChanged" AutoPostBack="true">
<asp:ListItem Value="sellnews">出售信息</asp:ListItem>
<asp:ListItem Value="buynews">收购信息</asp:ListItem>
</asp:RadioButtonList>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:DataGrid ID="myDataGrid" runat="server" ItemStyle-Font-Size="x-small" HeaderStyle-Font-Bold="True" HeaderStyle-Font-Size="x-small" AlternatingItemStyle-BackColor="#EFEFEF" Cellpadding="4" BorderWidth="1" AutoGenerateColumns="False" BorderStyle="Solid" GridLines="Horizontal" BorderColor="#404040" Font-Names="Verdana,Arial,sans-serif" Font-Size="11px">
<AlternatingItemStyle BackColor="#E0E0E0"> </AlternatingItemStyle>
<ItemStyle Font-Size="X-Small"></ItemStyle>
<HeaderStyle Font-Size="X-Small" Font-Bold="True" ForeColor="White" BackColor="silver"></HeaderStyle>
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<b>信息列表</b>
</HeaderTemplate>
<ItemTemplate>
<table border="0" cellpadding="4" cellspacing="0" width="500px" style="FONT-SIZE: 11px; FONT-FAMILY: Verdana, Arial, sans-serif">
<tr>
<td colspan="4">
<b>
<%# DataBinder.Eval( Container.DataItem, "comID" ) %>
</b>
</td>
</tr>
<tr>
<td width="60px" valign="top"><b>公司名称:</b></td>
<td width="100px" valign="top" nowrap="nowrap">
<%# DataBinder.Eval( Container.DataItem, "comID" ) %>
</td>
<td width="60px" valign="top"><b>联系电话:</b></td>
<td width="100px" valign="top" nowrap="nowrap">
<%# DataBinder.Eval( Container.DataItem, "comID" ) %>
</td>
</tr>
<tr>
<td width="60px" valign="top"><b>标题:</b></td>
<td width="100px" valign="top">
<%# DataBinder.Eval( Container.DataItem, "comID" ) %>
</tr>
<tr>
<td width="60px" valign="top"><b>公司地址:</b></td>
<td width="100px" valign="top" colspan="3">
<%# DataBinder.Eval( Container.DataItem, "comID" ) %>
<br />
<%# DataBinder.Eval( Container.DataItem, "comID" ) %>
<%# DataBinder.Eval( Container.DataItem, "comID" ) %>
<%# DataBinder.Eval( Container.DataItem, "comID" ) %>
<br />
<%# DataBinder.Eval( Container.DataItem, "comID" ) %>
</td>
<td>
<asp:Button ID="Button3" runat="server" Text="修改" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:Panel>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:Panel>
</div>
</form>
</body>
</html>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Default2 : System.Web.UI.Page
{
DataSet ds = new DataSet();
string comEmail;
protected System.Data.SqlClient.SqlDataReader dr;
int comID;
public void Page_Load(object sender, EventArgs e)
{
string myConnString = "server=.\\SQLEXPRESS;database=151;user id=sa;password=tmdjsj"; //连接sql数据库
SqlConnection myConn = new SqlConnection(myConnString);
myConn.Open();
string strSelS = "select * from sell";
string strSelB = "select * from buy";
SqlDataAdapter myAdapter1 = new SqlDataAdapter(strSelS, myConn);
myAdapter1.Fill(ds,"sell");
SqlDataAdapter myAdapter2 = new SqlDataAdapter(strSelB,myConn);
myAdapter2.Fill(ds, "buy");
string str=Session["comName"].ToString();
string strSelU = "select * from companylist where comName='"+str+"'";
SqlCommand cmd = new SqlCommand(strSelU,myConn);
dr = cmd.ExecuteReader();
if (dr.Read())
{
comID = int.Parse(dr["comID"].ToString());
string comName=dr["comName"].ToString();
comEmail = dr["comEmail"].ToString();
Session["comID"] = comID.ToString();
}
dr.Close();
TableRow tr1=new TableRow();
TableRow tr2 = new TableRow();
TableRow tr3 = new TableRow();
TableCell tc11=new TableCell();
TableCell tc21 = new TableCell();
TableCell tc31 = new TableCell();
tc11.Text="尊敬的"+str+"你好";
tc21.Text = "你的邮箱是:";
tc31.Text = comEmail;
tr1.Cells.Add(tc11);
tr2.Cells.Add(tc21);
tr3.Cells.Add(tc31);
userinfo.Rows.Add(tr1);
userinfo.Rows.Add(tr2);
userinfo.Rows.Add(tr3);
if (Page.IsPostBack)
{
DataBind();
}
myConn.Close();
}
public void RadioButtonList1_SelectedChanged(object sender, EventArgs e)
{
if (ds.Tables.Count > 0)
{
if (RadioButtonList1.SelectedItem.Value == "sellnews")
{
if (ds.Tables["sell"].Rows.Count > 0)
{ /*for (int i = 0; i < ds.Tables["sell"].Rows.Count; i++)
{
TableRow tr = new TableRow();
TableCell tc1 = new TableCell();
TableCell tc2 = new TableCell();
TableCell tc3 = new TableCell();
tc1.Text = ds.Tables["sell"].Rows[i]["sellcomName"].ToString();
tc2.Text = ds.Tables["sell"].Rows[i]["sellIndex"].ToString();
tc3.Text = ds.Tables["sell"].Rows[i]["sellParticular"].ToString();
tr.Cells.Add(tc1);
tr.Cells.Add(tc2);
tr.Cells.Add(tc3);
Table3.Rows.Add(tr);
}*/
//HeaderTemplate.HeaderText = "123";
//myDataGrid.Columns.Add(HeaderTemplate);
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>