111,125
社区成员
发帖
与我相关
我的任务
分享
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="编号">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Code") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="名称">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="详情">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Show") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Dictionary<string, string> data = new Dictionary<string, string>();
data.Add("D0001", "徐水长虹橡塑有限公司1");
data.Add("D0002", "徐水长虹橡塑有限公司2");
data.Add("D0003", "徐水长虹橡塑有限公司3");
data.Add("D0004", "徐水长虹橡塑有限公司4");
DataTable Dt = new DataTable();
DataRow dr;
int id = 1;
Dt.Columns.Add("Num", typeof(string));
Dt.Columns.Add("Code", typeof(string));
Dt.Columns.Add("Name", typeof(string));
Dt.Columns.Add("Show", typeof(string));
foreach (string skey in data.Keys)
{
dr = Dt.NewRow();
dr[0] = id.ToString();
dr[1] = skey;
dr[2] = data[skey];
dr[3] = "<a href='CG_CGDMXI.aspx?cgdhao=" + Server.UrlEncode(skey) + "&gyshmcheng=" + Server.UrlEncode(data[skey]) + ">详情</a>";
Dt.Rows.Add(dr);
id++;
}
this.GridView1.DataSource = Dt;
this.GridView1.DataBind();
public static string GetParameterRaw(string paraname, string rawurl)
{
string paravalue = string.Empty;
string reg = "[&?]" + paraname + "=([^&]*)";
MatchCollection matches = Regex.Matches(rawurl, reg, RegexOptions.IgnoreCase);
if (matches.Count > 0)
{
paravalue = matches[0].Groups[1].Value;
}
paravalue = paravalue.Trim();
return paravalue;
}