Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
More on the DataGrid
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00840918
Message ID:
00841240
Views:
26
>>After posting with Cathi on the finer points of actually binding the dg I created a template column. Beauty, except I cant get to the properties of the control... I can get the ID I assigned to it but not the text. :(
>>
*** This is from the watch window ***
>>e.Item.Cells(3).Controls(1).id = "txtQty"

>>I have no idea why the object is not exposed/obvious to me.
>>
>>Lost,
>
>
>Are you doing late or early binding? In the code behind or in the aspx?

I am setting the template col up using the property builder. However the rest of the cols are bound at runtime in the code behind as follows:

'VB Code behind
Dim DS As DataSet
Dim MyConnection As New SqlConnection
Dim MyCommand As SqlDataAdapter
Private SqlCn As New SqlConnection(GetDBConnectionString)
MyCommand = New SqlDataAdapter(strSQL, SqlCn)
DS = New DataSet("MyProductDS")
MyCommand.Fill(DS, "Product")
grdProducts.DataSource = DS.Tables("Product").DefaultView
Me.DataBind()
MyConnection.Close()
HTML grid tag (if it matters ... )
<asp:DataGrid id="grdProducts" runat="server" BackColor="#DEBA84" BorderStyle="None" AllowSorting="True"
	AllowPaging="True" HorizontalAlign="Justify" CellSpacing="1" CellPadding="1" BorderWidth="1px"
	BorderColor="#DEBA84">
	<EditItemStyle Wrap="False"></EditItemStyle>
	<Columns>
		<mbrsc:RowSelectorColumn Visible="False" AllowSelectAll="True"></mbrsc:RowSelectorColumn>
		<asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" CancelText="Cancel" EditText="Add">
		</asp:EditCommandColumn>
		<asp:ButtonColumn Text="Remove" ButtonType="PushButton" CommandName="Delete"></asp:ButtonColumn>
		<asp:TemplateColumn HeaderText="Qty">
			<ItemTemplate>
				<asp:TextBox id="txtQty" runat="server" Width="22px">1</asp:TextBox>
			</ItemTemplate>
		</asp:TemplateColumn>
	</Columns>
	<PagerStyle VerticalAlign="Middle" HorizontalAlign="Center" ForeColor="#8C4510" Position="TopAndBottom"
		Wrap="False" Mode="NumericPages"></PagerStyle>
</asp:DataGrid></TD>
My humble thanks in advance,
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform