I have a datalist that I am passing a value into a hidden field and I am then
trying to pass the value outside of the control into a Button object.
Is there any way to do this?
here is the code
line 36, 48
the field is
<asp:HiddenFiel d ID="HiddenCompa nyID" runat="server" Value=' <%# Container.DataI tem("UserAccoun tsCompanyID")%> ' />
and I'm trying to pass it to
CType(FindContr ol("HiddenCompa nyID"), HiddenField).Va lue
which is obviously wrong
trying to pass the value outside of the control into a Button object.
Is there any way to do this?
here is the code
line 36, 48
the field is
<asp:HiddenFiel d ID="HiddenCompa nyID" runat="server" Value=' <%# Container.DataI tem("UserAccoun tsCompanyID")%> ' />
and I'm trying to pass it to
CType(FindContr ol("HiddenCompa nyID"), HiddenField).Va lue
which is obviously wrong
Code:
<asp:DataList ID="DataListCompanyResults" runat="server" Width="100%"
BorderColor="#AEADAD" BorderStyle="Solid" BorderWidth="1px" CellPadding="0"
ForeColor="#333333">
<AlternatingItemStyle BackColor="White" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderTemplate>
<div style="text-align: left; background-image: url('/Images/Blk_Grd_Bg.jpg'); height: 20px; vertical-align: middle;"> Results: </div>
</HeaderTemplate>
<ItemStyle BackColor="#EFF3FB" />
<ItemTemplate>
<div style="margin: 4px">
<table width="100%">
<tr>
<td style="text-align: left; width: 200px;">
<%# Linkformat(Container.DataItem("CompanyName"), Container.DataItem("UserAccountsID"), Container.DataItem("UserAccountsCompanyID"))%>
</td>
<td style="text-align: left">
<%# Container.DataItem("CompanyAddress1")%>
<%# Container.DataItem("CompanyAddress2")%>
<br />
<%# Container.DataItem("CompanyCity") & "," %>
<%# Container.DataItem("Region")%>
<%# FormatPostalCode(Container.DataItem("CompanyPostalCode"))%>
</td>
<td style="text-align: right">
<obout:OboutButton ID="ButtonClaimBusiness" runat="server"
CommandName="ClickClaimBusiness" text="Claim Business" width="120" />
</td>
</tr>
</table>
<asp:HiddenField ID="HiddenCompanyID" runat="server" Value=' <%# Container.DataItem("UserAccountsCompanyID")%>' />
</div>
</ItemTemplate>
<SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
</asp:DataList>
Protected Sub ButtonAgree_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonAgree.Click
Dim UserAccountsCompanyID = CType(FindControl("HiddenCompanyID"), HiddenField).Value
If CheckboxIagree.Checked = True Then
Dal.UpdateClaimedBusiness(Dal.GetUserID, UserAccountsCompanyID)
MultiViewBusiness.SetActiveView(ViewConfirm)
UpdateConfirm2.Text = "This Business has now been Claimed as yours"
Else
LiteralClaimBusiness.Text = "You Must Agree to the Terms and Conditions"
End If
End Sub