T
TN Bella
I have a datagrid populated from a SQL table that contains a checkbox,
when the user clicks on the row 3 fields from that row are than
displayed on the screen. What I NEED is for that information to populate
three textboxes so it can be send to another SQL table. Here is what my
code looks like now; can anyone help me fill the textboxes instead. I
couldn't find too much help on the subject so I am posting this
here...thanks! BTW, I am using the 1.0 .net framework.
--- when the checkbox is clicked the user clicks a button to access
this Sub ---
Sub GetItems(Source as Object, E as EventArgs)
Dim GridItem As DataGridItem
Dim chkBox as System.Web.UI.WebControls.CheckBox
Dim sName, sCode, sPay as String
For Each GridItem In MyDataGrid.Items
chkBox = GridItem.FindControl("myCheckbox")
If chkBox.Checked Then
sName=CType(GridItem.FindControl("lblName"),
Label).Text & " " & _
CType(GridItem.FindControl("lblCode"), Label).Text
sPay=GridItem.Cells(3).Text
sPay += sName & sCode & ", "
End If
Next
sPay=sPay.Substring(0,sPay.length-2)
label1.text="<b>You Chose :</b> <br>" & sPay
End Sub
-- here is my datagrid --
<asp
atagrid id="MyDataGrid" runat="server"
AutogenerateColumns="False" BorderColor="#000000" Font-Size="8"
Font-Name="Verdana" BackColor="#E8E9D6"
AlternatingItemStyle-BackColor="#ff6633" Headerstyle-Font-Size="8"
Headerstyle-Font-Name="Verdana" Headerstyle-BackColor="#ff6633"
cellspacing="0" cellpadding="3" GridLines="Both">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="myCheckbox"
Runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Supplier Name">
<ItemTemplate>
<asp:Label id="lblName" runat="server"
text='<%# DataBinder.Eval(Container.DataItem, "splr_name") %>' />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Supplier Code">
<ItemTemplate>
<asp:Label id="lblCode" runat="server"
text='<%# DataBinder.Eval(Container.DataItem, "supplier_cd") %>' />
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn Datafield="splr_sfx"
HeaderText="Pay Point">
</asp:BoundColumn>
<asp:BoundColumn Datafield="splr_addr"
HeaderText="Address">
</asp:BoundColumn>
<asp:BoundColumn Datafield="splr_city"
HeaderText="City">
</asp:BoundColumn>
<asp:BoundColumn Datafield="splr_state"
HeaderText="State">
</asp:BoundColumn>
</Columns>
</asp
atagrid>
-- Here are the textboxes I want to fill --
<asp:TextBox id="txtSupName" runat="server"></asp:TextBox>
<asp:TextBox id="txtSupCD" runat="server"></asp:TextBox>
<asp:TextBox id="txtSupsfx" runat="server"></asp:TextBox>
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
when the user clicks on the row 3 fields from that row are than
displayed on the screen. What I NEED is for that information to populate
three textboxes so it can be send to another SQL table. Here is what my
code looks like now; can anyone help me fill the textboxes instead. I
couldn't find too much help on the subject so I am posting this
here...thanks! BTW, I am using the 1.0 .net framework.
--- when the checkbox is clicked the user clicks a button to access
this Sub ---
Sub GetItems(Source as Object, E as EventArgs)
Dim GridItem As DataGridItem
Dim chkBox as System.Web.UI.WebControls.CheckBox
Dim sName, sCode, sPay as String
For Each GridItem In MyDataGrid.Items
chkBox = GridItem.FindControl("myCheckbox")
If chkBox.Checked Then
sName=CType(GridItem.FindControl("lblName"),
Label).Text & " " & _
CType(GridItem.FindControl("lblCode"), Label).Text
sPay=GridItem.Cells(3).Text
sPay += sName & sCode & ", "
End If
Next
sPay=sPay.Substring(0,sPay.length-2)
label1.text="<b>You Chose :</b> <br>" & sPay
End Sub
-- here is my datagrid --
<asp
AutogenerateColumns="False" BorderColor="#000000" Font-Size="8"
Font-Name="Verdana" BackColor="#E8E9D6"
AlternatingItemStyle-BackColor="#ff6633" Headerstyle-Font-Size="8"
Headerstyle-Font-Name="Verdana" Headerstyle-BackColor="#ff6633"
cellspacing="0" cellpadding="3" GridLines="Both">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="myCheckbox"
Runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Supplier Name">
<ItemTemplate>
<asp:Label id="lblName" runat="server"
text='<%# DataBinder.Eval(Container.DataItem, "splr_name") %>' />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Supplier Code">
<ItemTemplate>
<asp:Label id="lblCode" runat="server"
text='<%# DataBinder.Eval(Container.DataItem, "supplier_cd") %>' />
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn Datafield="splr_sfx"
HeaderText="Pay Point">
</asp:BoundColumn>
<asp:BoundColumn Datafield="splr_addr"
HeaderText="Address">
</asp:BoundColumn>
<asp:BoundColumn Datafield="splr_city"
HeaderText="City">
</asp:BoundColumn>
<asp:BoundColumn Datafield="splr_state"
HeaderText="State">
</asp:BoundColumn>
</Columns>
</asp
-- Here are the textboxes I want to fill --
<asp:TextBox id="txtSupName" runat="server"></asp:TextBox>
<asp:TextBox id="txtSupCD" runat="server"></asp:TextBox>
<asp:TextBox id="txtSupsfx" runat="server"></asp:TextBox>
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!