Hi, im new to ASP.Net, just playing around with it...
Got a simple question. I am trying to display my Textboxes next to my datagrid, but for some reason, it's always at the bottom of my datagrid. I playing around with this for an introduction to ASP.net. Anyway, i've tried div and it does'nt work for me.
<script runat="server">
void CustomersGridView_SelectedIndexChanged(Object sender, EventArgs e)
{
SqlConnection thisConnection = new SqlConnection(@"Data Source=prl-sql08-01;Initial Catalog=RemoteDownload;Integrated Security=True");
using (SqlCommand thisCommand = new SqlCommand(ConfigurationManager.AppSettings["RemoteDownloadConnectionString"]))
{
SqlCommand command = new SqlCommand("select * FROM [RemoteDownload].[dbo].[CameronTest]", thisConnection);
thisConnection.Open();
SqlDataReader rdr = null;
rdr = command.ExecuteReader();
int i = 0;
while (rdr.Read())
{
string a = (string)rdr["Terminal"];
TextBox Step = new TextBox();
Step.ID = "Step " + i.ToString();
Step.TextMode = TextBoxMode.MultiLine;
Step.Text = a;
Panel1.Controls.Add(Step);
i++;
}
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" CellPadding="4" ForeColor="#333333"
onselectedindexchanged="CustomersGridView_SelectedIndexChanged"
GridLines="Vertical" AllowSorting="True">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
</Columns>
<EditRowStyle BackColor="#7C6F57" />
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#E3EAEB" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F8FAFA" />
<SortedAscendingHeaderStyle BackColor="#246B61" />
<SortedDescendingCellStyle BackColor="#D4DFE1" />
<SortedDescendingHeaderStyle BackColor="#15524A" />
</asp:GridView>
<asp:Panel ID="Panel1" runat="server"></asp:Panel>
<br/>
<asp:label id="MessageLabel"
forecolor="Red"
runat="server"/>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:RemoteDownloadConnectionString %>"
SelectCommand="USE RemoteDownload SELECT Name FROM sys.Tables">
</asp:SqlDataSource>
</form>
</body>
</html>