473,320 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Is there a way to pass a variable outside of a datalist?

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:HiddenField ID="HiddenCompanyID" runat="server" Value=' <%# Container.DataItem("UserAccountsCompanyID")%>' />


and I'm trying to pass it to
CType(FindControl("HiddenCompanyID"), HiddenField).Value
which is obviously wrong



Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <asp:DataList ID="DataListCompanyResults" runat="server" Width="100%" 
  4.             BorderColor="#AEADAD" BorderStyle="Solid" BorderWidth="1px" CellPadding="0" 
  5.             ForeColor="#333333">
  6.             <AlternatingItemStyle BackColor="White" />
  7.             <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  8.             <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  9.         <HeaderTemplate>
  10.            <div style="text-align: left; background-image: url('/Images/Blk_Grd_Bg.jpg'); height: 20px; vertical-align: middle;">&nbsp; Results: </div> 
  11.         </HeaderTemplate>
  12.             <ItemStyle BackColor="#EFF3FB" />
  13.             <ItemTemplate>
  14.             <div style="margin: 4px">
  15.                 <table width="100%">
  16.                     <tr>
  17.                         <td style="text-align: left; width: 200px;">
  18.  
  19.                         <%# Linkformat(Container.DataItem("CompanyName"), Container.DataItem("UserAccountsID"), Container.DataItem("UserAccountsCompanyID"))%>
  20.  
  21.                         </td>
  22.                         <td style="text-align: left">
  23.                             <%# Container.DataItem("CompanyAddress1")%>
  24.                             <%# Container.DataItem("CompanyAddress2")%>
  25.                             <br />
  26.                             <%# Container.DataItem("CompanyCity") & "," %>
  27.                             <%# Container.DataItem("Region")%>
  28.                             <%# FormatPostalCode(Container.DataItem("CompanyPostalCode"))%>
  29.                         </td>
  30.                         <td style="text-align: right">
  31.                             <obout:OboutButton ID="ButtonClaimBusiness" runat="server" 
  32.                                 CommandName="ClickClaimBusiness" text="Claim Business" width="120" />
  33.                         </td>
  34.                     </tr>
  35.                 </table>
  36.                 <asp:HiddenField ID="HiddenCompanyID" runat="server" Value=' <%# Container.DataItem("UserAccountsCompanyID")%>' />
  37.            </div>
  38.             </ItemTemplate>
  39.             <SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
  40.         </asp:DataList>
  41.  
  42.  
  43.  
  44.  
  45.  
  46. Protected Sub ButtonAgree_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonAgree.Click
  47.  
  48.         Dim UserAccountsCompanyID = CType(FindControl("HiddenCompanyID"), HiddenField).Value
  49.  
  50.         If CheckboxIagree.Checked = True Then
  51.  
  52.             Dal.UpdateClaimedBusiness(Dal.GetUserID, UserAccountsCompanyID)
  53.             MultiViewBusiness.SetActiveView(ViewConfirm)
  54.             UpdateConfirm2.Text = "This Business has now been Claimed as yours"
  55.         Else
  56.             LiteralClaimBusiness.Text = "You Must Agree to the Terms and Conditions"
  57.         End If
  58.  
  59.  
  60.     End Sub
  61.  
  62.  
  63.  
Dec 24 '10 #1
0 852

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: GB | last post by:
Hello: In my MS Access project I have two objects - my form and my report. I need to pass variable value from Command_click procedure of my form to Report_open procedure of my report. How can I...
1
by: Ben Kial | last post by:
I'd like to write a wrapper function "mysprintf(char *buffer, char *format, ....)" which calls sprintf(). My question is how can I pass variable argument in mysprintf() to sprintf(). Thanks in...
8
by: darrel | last post by:
I'm still trying to fully understand how best to pass variables between pages/usercontrols/each other. On a current site I've done, I've had one userControl do the logic and set the variable,...
1
by: dollar | last post by:
I want to ask what is the best way to pass variable between asp.net we pages, and user controls , any examples - dolla -----------------------------------------------------------------------...
1
by: drec | last post by:
I need to pass a variable from script1.php to script2.php. The problem is that these scripts use frames and therefore I am able to pass the variable through the URL. It also does not use forms to...
1
by: vijaynarang | last post by:
strCmdLine = " " + " -o restore -url " + sSitePath + "/sites/" + sToplevelSiteName + " -filename " + sFileName+ " -overwrite "; process1 =...
1
by: AJ | last post by:
Hi all, I am trying pass a value to the DataSource method in a DataList like below. DataSource = <%# GetData(DataBinder.Eval(Container.DataItem, "ID"))%>" I get an error with this code, and am...
1
by: rn5a | last post by:
A ASPX page has a DataList control with a few Labels. This page also has a CheckBox which resides OUTSIDE the DataList. By default, this CheckBox is checked. If the CheckBox is checked, then the...
12
by: simon2x1 | last post by:
i have a page which is home.php on that page i have a CSS tab which is tab1 and tab2 on that page in both tabs i have a link called next that pass variable to the next page (<a...
2
by: peachdot | last post by:
hi, The MainForm will have 2 buttons: 1.) Button A : User click button A, hide Mainform then go to form1. User enter data in the textbox.Click finish button,form1 close then go back to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.