Arraylist As Repeater Datasource - Can Access From .aspx

Apr 16, 2010

I have an arraylist:

Dim downloadsarray As New ArrayList
downloadsarray.Add(iconlink)
downloadsarray.Add(imgpath)
downloadsarray.Add(filesize)
downloadsarray.Add(description)

Which is the datasource of my repeater:

DownloadsRepeater.DataSource = downloadsarray
DownloadsRepeater.DataBind()

how I output the items in the array to the .aspx page. I usually use (when using sqldatareader as datasource):

<%#Container.DataItem("1stcolumnnamestring")%>
<%#Container.DataItem("2ndcolumnnamestring")%>

But this does not work when using the arraylist as datasource.

View 3 Replies


Similar Messages:

Access The First And / Or Last Item In An Bound ArrayList?

Mar 21, 2011

I've got an ArrayList bound to a repeater control. In an associated, but separate, area of the page, I'd like to get the first and last item out of the bound control. It's actually a paging element to a table.

Here is the code for the Repeater:

this.Repeater1.DataSource = pagingArray;<br>
this.Repeater1.DataBind();<br>
<asp:Repeater id="Repeater1" runat="server"><br>
<ItemTemplate><br>
<a href="/?page=<%# Container.DataItem %>"><%# Container.DataItem %?</a><br>
</ItemTemplate><br>
</asp:Repeater><br>

I'd like to get the first element from this repeater and display it. The code that I have right now (that doesn't work) is:

<% Response.Write(Repeater1.Items[0].ToString()); %>

View 1 Replies

Forms Data Controls :: Autosize Listview Images From Access Datasource To Fit To A Cell In Aspx?

Jul 29, 2010

I am working on setting up an aspx page using access datasource in web eepression. Access Datasource is having image source information from other resources feed. I am using listview to display all the images.
The problem I am facing is that all the images are displaying in different sizes. I tried to customize Layout template by specifying the td height and width but it's not working. Is there any way to autosize the pictures in listview once page is displayed.

<LayoutTemplate>
<table runat="server">
<tr runat="server">

[code]...

View 3 Replies

State Management :: Multidimentional Arraylist / Create A Arraylist Which Will Able To Store User Info?

Jul 16, 2010

i want to create a arraylist which will able to store user info like (username,machineIP,port ) for each user in the list & retrive this data when needed . any one tell me how i can do it or any alternative way without database or xml file.

View 6 Replies

How To Access Repeater Item Template Controls Outside The Repeater

Feb 2, 2011

I am using a repater whose item template is having a dropdownlist. Now i want to access that dropdownlist from a button click event. Here is the code iam using :

protected void btn1_Click(object sender, EventArgs e)
{
foreach (RepeaterItem item in rptWord.Items)
{
DropDownList ddl1 = (System.Web.UI.WebControls.DropDownList)rptWord.FindControl("ddlWord");
}
}

But m getting ddl1 as null. For this i created a function which is as follows:

public void myFunction(object sender, RepeaterItemEventArgs e)
{
foreach (RepeaterItem item in rptWord.Items)
{
DropDownList la = (System.Web.UI.WebControls.DropDownList)e.Item.FindControl("ddlWord");
}
}

using this function iam able to access the repeater but i guess its not possible to call this function on button click event .

View 3 Replies

C# - How To Access One Repeater's Control Into Another Repeater's OnItemCommand() Method

Oct 15, 2010

lets say I want to make a label of repeater1 visible in repater2's ItemCommand() method..

e.Item.FindControl("rpt1Label").Visible=True;

is not working..how else do you do it ?

[EDIT]

changed that to repeater1.FindControl("rpt1Label").Visible=True;

This is throwing object reference null exception

View 1 Replies

DataSource Controls :: Use ArrayList In SqlCommand

May 1, 2010

I want to add array list in sqlcommand.but i don't no how to pass it. My code is.

ArrayList
ProductId = new
ArrayList();
for (int i = 0; i < ShipmentPackage.Items.Count; i++)
{
ProductId.Add(ShipmentPackage.Items[i].ProductVariant.ProductID);
}
select * from TableName where id= ProductId(ProductId is my Arraylist)

View 3 Replies

DataSource Controls :: Get ArrayList Value In SqlDataReader

Sep 24, 2010

I'm trying to convert some code from VB to C# on a site i'm working on and can't seem to get the arraylist to function properly.

Here is what we currently have in the codebehind:

[Code]....

Which we then call from the page using:

[Code]....

I want to convert this to C# as the rest of the code on the new site is in C# and I'm having problems with the ArrayList. I've got the other parts of the code all converted fine it's just the GetContent Function that isn't working right. Here's what I have:

[Code]....

I got an error on the "objSDR.Item" part of the code saying "SqlDataReader doesn't have definition for Item" and so if I changed this to the code above. Only problem now is I can't call this from the page using the code below as there is no "Item" in the GetContent Function any more

[Code]....

[Code]....

View 8 Replies

Forms Data Controls :: Create Bar Graph From ArrayList And DataSource?

Jan 16, 2011

I have a web page where a GridView will be shown with a column of different products and another column with checkboxes. Checking on the checkboxes will be equivalent to selecting the products. The selected products are saved to an arraylist. Then, the user has to click on a button located on the same page to analyze the selected products. On clicking the button, he/she will be directed to another page where a bar graph will be shown. The bar graph will be the result of having analyzed the products. How do I create the bar graph where the products are taken from the arraylist but I can make use of the datasource within the chart control to retrieve more detailed info(such as product sales) from the database, taking into account the products from the arraylist?

View 3 Replies

Web Forms :: Access Code In App_code From Aspx (not Aspx.cs)

Jul 2, 2010

I put common code in the app_code directory. I access classes in the code all the time from aspx.cs files by "using" the name space from the C# file in app_code and then referencing the class. Now I want to access a class from an app_code file a aspx file. How do I do this?

View 8 Replies

Access The Html Button In Aspx.cs Page?if Access How

Jan 7, 2010

i have a doubt if i write html button in source code, how can i access in aspx.cs,

View 3 Replies

Web Forms :: Can Access GridView In Customer.aspx File From Another NewUserLogin.aspx File

Jun 23, 2010

How can I access my GridView in Customer.aspx file from another NewUserLogin.aspx file.

How should I chnge the access to my GridView to public so that I can chnge its values from another aspx file

View 5 Replies

Web Forms :: Calling Codebehind Vb.net Function From Aspx Page And Itemcomand In Repeater?

Jun 30, 2010

I have been trying to call a vb.net function in aspx page how can i do that?. I have done it in C# by

<td><#%GetItemIndex(Container.ItemIndex)%></td> its working fine in C# but in vb.net it says GetItemIndex not declared.

and trying to convert (rptpages is a repeater)

rptpages.Itemcommand += New RepeaterCommandEventHandler( rptpages_ItemCommand1) from C# to VB.net but i dont see itemcommand property in VB.net for the repeater.

View 15 Replies

C# - How To Access A Div Inside A Repeater Using Javascript

Nov 29, 2010

Simply, I have an anchor inside a repeater that triggers on click a javascript function, which sets the innerHTML of a Div to some content.

trying this outside a repeater did work! but if I tried to implement the same code in the repeater's item template, it won't work!

NOTE: I think I need to access the repeater first then access the Anchor inside it! but I don't know how to do it

For further illustration:

JavaScript Function:

function show(ele, content) {
var srcElement = document.getElementById(ele);
if (srcElement != null) {
srcElement.innerHTML = content;
}
}

The repeater's code:

<asp:Repeater ID="Repeater1" runat="server" >
<ItemTemplate>
Name : <%# Eval("name")%>
<DIV ID= "PersonalInfo1" runat="server"></DIV>
<A id="A1" href="#" runat="server" onclick="show('PersonalInfo1','Address : ')">More...</A>
</ItemTemplate>
</asp:Repeater>

PS: THE POSTED CODE ISN'T WORKING IN THE REPEATER!

View 3 Replies

C# - How To Access Repeater Items From JavaScript

Aug 4, 2010

I've got a hidden control inside a repeater. How can I access this from JavaScript?

View 1 Replies

Access The Current Record In An Asp:Repeater?

Nov 9, 2010

Suppose I have an asp:Repeater that I am using to display a list of names and phone numbers.

<asp:Repeater runat="server">
<ItemTemplate>
<p><%# Eval("name") %></p>
<p><%# Eval("phoneNumber") %></p>
</ItemTemplate>
</asp:Repeater>

Now, let's make it more fun. Let's suppose that there is one or more phone number per name. I feel like I could use a repeater within a repeater to repeat the phone numbers. I could also use a for loop in my asp code. However, the Eval function is the only way I know of to access the current record at runtime and Eval only returns a string and only runs in <%# Eval("X") %>. How can I get the list of phone numbers that is a member of the current record?

View 1 Replies

DataSource Controls :: How To Access Database Once With Big Resultset Or Access Multiple Times On The Fly

Jun 17, 2010

I have a situation where I am accessing a database multiple times and I'm wondering if it is necessary.

I have a GridView with a template column with a hyperlink to "Get Results" and on the RowDataBound event I have it check the batch number against the database and see if results exist and then if they don't, hide the link.

So when viewing the page if there is 20 rows in the gridview it is effectively doing 20 queries.

I was wondering if it is a better idea to query the database once with all "batches" and load it into a datatable, then on the RowDataBound event query the datatable. The only issue I see with this is there is currently 40,000 batches and grows daily.

View 1 Replies

C# - How To Access A CheckBox Inside A Repeater Header

Feb 18, 2011

I have a repeater which has a checkBox in the headerTemplate

[code]...

how I can get the value of that checkBox in the code behind.

View 1 Replies

Forms Data Controls :: How To Access Two Repeater

Dec 27, 2010

Here i am using two repeater controls.

i am creating repeater2 inside the repeater1.

But i cant access repeater2 directly on my webform.

so what is the solution for that?

View 1 Replies

Access Data Repeater's Item By Index Instead Of Explicit Name?

May 21, 2010

Right now I'm using the following code in my markup:

<asp:HiddenField ID="TheName" runat="server" Value=<%#Eval("SpeakerName")%> />

I would like to use:

<asp:HiddenField ID="TheName" runat="server" Value=<%#Eval(0)%> />

I would like to be able to call it by index instead of explicitly by "SpeakerName". Is there a way to do this in ASP.NET 4.0?

View 1 Replies

C# - How To Access ItemTemplate Control From ItemCommand Event Using Repeater

Nov 26, 2010

My repeater:

<asp:Repeater ID="rptrContacts" runat="server" OnItemCommand="rptrContact_ItemCommand" >
<div ID="itemTemplate>
<ItemTemplate>
<%# Eval("Name") %>
<%# Eval("Email") %>
<asp:LinkButton ID="lbtnEditContact" runat="server" CommandName="Edit" Text="Edit" CommandArgument='<%# Eval("ContactID") %>' />
<asp:Label ID="lblUpdateConfirm" runat="server" Text="Update Confirmed" Visible="false" />
</ItemTemplate>
</div>
<div ID="editTemplate runat="server" visibility="false">
Update your Info:<br>
Name: <asp:TextBox ID="txtName" runat="server Text="<%# Eval("Name") %>"/> <br>
Email: <asp:TextBox ID="txtEmail" runat="server Text="<%# Eval("Email") %>"/><br>
<asp:LinkButton ID="lbtnUpdateContact" CommandArgument='<%# Eval("ContactID") %>' CommandName="UpdateContact" runat="server" >Update</asp:LinkButton>
</div>
</asp:Repeater

and code for ItemCommand:

switch(e.CommandName)
{
case "Edit":
//make editTemplate div visible
HtmlGenericControl divEditContact = (HtmlGenericControl)e.Item.FindControl ("divEditContact");
divEditContact.Visible = true;
break;
case "Update":
Employee updateEmployee = new Employee
{
employeeName = txtName.Text:
employeeEmail = txtEmail.Text:
}
updateEmployee = API.UpdateEmployee(updateEmployee);
//display lblUpdateConfirm visible to True
// so user sees this confirm messge in the newly updated ItemTemplate
}

How can I access my lblUpdateConfirm and turn its Text state to visible from inside the ItemCommand, so that when the user sees the newly updated ITemTemplate, the label is showing the "Update Confirmed" message?

View 1 Replies

Forms Data Controls :: How To Add And Access To Placeholder In A Repeater Control

Aug 16, 2010

i want to add and access to placeholder in a repeater control. for example,

[Code]....

how can i acces to placeholder, on codebehind. i couldn't acces with it's id.

View 3 Replies

Forms Data Controls :: Access A GridView That's Inside A Repeater?

Mar 6, 2011

I have a GridView inside a repeater, and for all the GridView events such as ItemDataBound, etc. I can't just use the same because it doesn't recognize it. I know I have to use FindControl and type in the ID, but how?

View 6 Replies

Security ::User Authorisation / Access - Perform Function Via Button In Repeater?

Apr 28, 2010

I'm looking to write some script that checks that: The current user of whom is logged in has the correct authority credentials. NB: Script in C# before I continue. To give a bit more background. The SQL DB Table for AdminUsers has a field 'Authority' this is linked to another table (Authority) which has the values/different levels of authority in them. Thus, if aN admin user whose Authority level is just listed as 'user', for example, in the database and wants to edit information that requires 'Supeuser' authority level - it cannot be performed and is redirected to another page. In detail, my particular page, the operation is being done via a ASP Button within a ASP Repeater. Of each record that occurs there is the button that, once pressed, updates the field in the database (in this case for a Guestbook table which has a 'Moderated' field of 'bit/bool' data type, changing it from false to true (or 0/1)). To allow that entry to be displayed on the front-end for public viewing. All this can onyl happen on the basis of, as previously stated, their authority is of the appropriate level. Here is what my attempt was. The outcome of which simply redirects to the 'Unauthorised' page, despite the user logged in having the correct authority credentials.

ASP - GuestbookMod.aspx:

[Code]....

C# - GuestbookMod.aspx:

[Code]....

LINQ to SQL - Guestbook.cs 'Mod' Method:

[Code]....

View 8 Replies

Data Controls :: Find And Access Values In Repeater Footer Template?

Oct 21, 2015

How to access database values in footer template of repeater control in ASP.Net,C#. My Code is given below:

<asp:Repeater ID="rptrMaintenance" runat="server" OnItemDataBound="rptrMaintenance_DataBinding" >
<HeaderTemplate>
<table width="100%" cellpadding="0" cellspacing="0" valign="top">

[Code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved