I have the following front end code:
<asp:Panel ID="pn_TSAdmin" runat="server" GroupingText="Timesheet Admin" CssClass="Dashboard_Panel" Visible="false">
<div id="dv_ProjectSelect" runat="server" style="width:500px;" >
<asp:Label ID="lb_Project" runat="server" Text="Project:" CssClass="Label" />
<asp:DropDownList ID="ddl_Project" runat="server" CssClass="Label" />
<asp:ImageButton ID="ibt_AddProject" runat="server" ImageAlign="AbsBottom" ImageUrl="~/Images/add.png" CssClass="ibt_22" OnClick="Click_AddProject" />
<asp:ImageButton ID="ibt_ProjectStatus" runat="server" ImageAlign="AbsBottom" ImageUrl="~/Images/power.png" CssClass="ibt_22" OnClick="Click_SwitchProject" />
</div>
<div id="dv_ProjectAdd" runat="server" style="width:500px;" visible="false">
<asp:Label ID="lb_NewProject" runat="server" CssClass="Label" Text="Project Name: " />
<asp:TextBox ID="txt_NewProject" runat="server" CssClass="Label" />
<asp:ImageButton ID="ibt_SubmitNewProject" runat="server" ImageUrl="~/Images/go.png" CssClass="ibt_22" OnClick="Click_SubmitProject" />
<asp:ImageButton ID="ibt_CancelNewProject" runat="server" ImageUrl="~/Images/cancel.png" CssClass="ibt_22" OnClick="Click_CancelAddProject" />
</div>
</asp:Panel>
Code behind for ibt_AddProject:
protected void Click_AddProject (object sender, EventArgs e)
{
dv_ProjectSelect.Visible = false;
dv_ProjectAdd.Visible = true;
}
Which is using the following CSS Classes:
.Label
{
width:200px;
margin:10px auto 10px 20px;
}
.ibt_22
{
width:22px;
height:22px;
margin: 10px auto 10px 10px;
}
dv_ProjectSelect shows up as expected with the items lining up perfectly.
However when I click ibt_AddProject the items aren't showing correctly in dv_ProjectAdd as per the following picpaste showing the screen transition(http://picpaste.com/DumbCSS-173MxC30.jpg)
I've seen things mentioned about adding cursor:text and also z-index:999 but nonbe of which have helped with this issue.
Any idea why this is happening and how I could go about resolving it so it looks correct.
Related
I am using a GridView to display error information to be verified by the user. Then the user is given fillable fields (datepicker, dropdownlist, textbox) to fix the errors. These are outside of the GridView.
After, they have a submit button to save the changes to a sql log. The problem I am having is that because I'm passing in object sender, GridViewRowEventsArg e, the button doesn't recognize the GridView and I get an error:
No overload for 'btnSaveMemberErrorEdit_ButtonClicked' matches delegate 'System.EventHandler'
I am using asp.net with c# code behind. Sample code is:
ASP:
<div id="actionItemAccordion">
<h3>Action Items</h3>
<asp:Panel runat="server">
<asp:GridView runat="server" ID="gridActionItems" DataKeyNames="ErrorKey"
AutoGenerateColumns="false" EmptyDataText="No Action Items Were Found." ShowHeader="true"
ClientIDMode="Static" Width="100%">
<Columns>
<asp:BoundField HeaderText="Action Item" DataField="ActionItem" />
<asp:BoundField HeaderText="Month" DataField="Month" />
<asp:BoundField HeaderText="Data" DataField="DCode" />
<asp:BoundField HeaderText="Data2" DataField="D2Code" />
<asp:TemplateField>
<ItemTemplate>
<asp:RadioButtonList runat="server" ID="rbWinner" AutoPostBack="true" Font-Size="Smaller" >
<asp:ListItem Text="D1 Correct" Enabled="true" Value="D1" />
<asp:ListItem Text="D2 Correct" Enabled="true" Value="D2" />
</asp:RadioButtonList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Label runat="server" BorderWidth="2px" Width="850px"></asp:Label>
<div>
<asp:Label runat="server" Text="Edit Any Necessary Changes" Style="text-align: center"
Font-Size="Medium" Visible="true" Font-Bold="true" Width="100%" />
<br />
<br />
</div>
<div>
<asp:Label runat="server" Text="Effective Date: " Style="text-align: right"
Font-Size="Small" Visible="true" Width="200px" />
<asp:TextBox runat="server" ID="txtEffectiveDate" Text="" Style="text-align: left"
ClientIDMode="Static" Font-Size="13px" Columns="15" Height="15" Width="15%" />
<asp:Label runat="server" Text="Termination Date: " Style="text-align: right"
Font-Size="Small" Visible="true" Width="200px" />
<asp:TextBox runat="server" ID="txtTerminationDate" Text="" Style="text-align: left"
ClientIDMode="Static" Font-Size="13px" Columns="15" Height="15" Width="15%" />
<br />
<br />
</div>
<div>
<asp:Label runat="server" Text="New/Corrected Name: " Style="text-align: right"
Font-Size="Small" Visible="true" Width="200px" />
<asp:DropDownList runat="server" ID="ddlNewCode" AutoPostBack="false" AppendDataBoundItems="true"
Style="text-align: left" Width="220" BackColor="AliceBlue" ClientIDMode="Static"
DataTextField="Code" DataValueField="CodeKey">
</asp:DropDownList>
<br />
<br />
<asp:Label runat="server" BorderWidth="1px" Width="850px"></asp:Label>
<br />
</div>
<div>
<asp:Label runat="server" Text="Notes: " Style="text-align: right; vertical-align: middle"
Font-Size="Small" Visible="true" Width="200px" />
<asp:TextBox runat="server" ID="txtNotes" Text="" Style="text-align: left" ClientIDMode="Static"
Wrap="true" TextMode="MultiLine" Font-Size="10px" Columns="100" Height="100"
Width="50%" />
</div>
<div>
<asp:Button runat="server" ID="btnSaveErrorEdit" Text="Save Changes" OnClick="btnSaveErrorEdit_ButtonClicked"
Height="30px" Enabled="true" Width="95px" Style="margin-left: 330px; margin-top: 70px;
margin-bottom: 25px; padding: 0px; border-radius: 5px;" />
<asp:Button runat="server" ID="btnCancelEdit" Text="Cancel" OnClientClick="return CancelEdit();"
Enabled="true" Height="30px" Width="70px" Style="margin-right: 330px; margin-top: 70px;
margin-bottom: 25px; padding: 0px; border-radius: 5px;" />
</div>
</asp:Panel>
Code Behind:
protected void btnSaveErrorEdit_ButtonClicked(object sender, GridViewRowEventArgs e)
{
int hiddenErrorKey = Convert.ToInt32(e.Row.Cells[5].Text);
this.assignCorrect = e.Row.Cells[4].Text;
SqlCommand command = new SqlCommand("some_storedProc");
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("#ErrorKey", SqlDbType.Int).Value = hiddenErrorKey;
command.Parameters.Add("#EffectiveDate", SqlDbType.DateTime).Value = this.txtEffectiveDate;
command.Parameters.Add("#TerminationDate", SqlDbType.DateTime).Value = this.txtTerminationDate;
command.Parameters.Add("#Notes", SqlDbType.VarChar, -1).Value = this.txtNotes;
command.Parameters.Add("#NameOfInputUser", SqlDbType.VarChar, 50).Value = this.lblInputUserName;
command.Parameters.Add("#Code", SqlDbType.VarChar, 1).Value = this.assignWinner;
Utilities.Exec_Qry(this.Application["some_connection"].ToString(), command);
}
You need to change the function to take arguments for the asp:button
(object sender, EventArgs e)
Then you can grab the GridView in the behind code using
var button = sender as Button;
var view = button.FindControl("gridActionItems") as GridView;
Then you can access the elements as needed.
I am trying to change the color of the background when twa is at different values but it with my current code, the data is not firing, but when I remove the
<asp: Label id="TWAlabel" OnDataBinding="ListView2_OnDataBinding">
But when I remove OnDataBinding the data fires, so I have no idea what is wrong. I am doing this in Asp.net(C#), JavaScript, and the data is sourced from an Access database. Here is my code:
<style>
.YellowThis
{
background-color:yellow;
}
.RedThis
{
background-color:red;
}
.GreenThis
{
background-color:green;
}
</style> <asp:ListView id="ListView2" runat="server" DataSourceID="SqlDataSource3" EnableViewState="False">
</InsertItemTemplate>
<ItemTemplate>
<span style="background-color: white;color: #333333; border: 2em; border-width:1em; border-color:black;">
Plant Name:
<asp:Label id="PlantLabel" runat="server" Text='<%# Eval("Plant") %>' />
<br />
Department #:
<asp:Label id="column1Label" runat="server" Text='<%# Eval("column1") %>' />
<br />
Department Name:
<asp:Label id="GroupLabel" runat="server" Text='<%# Eval("Group") %>' />
<br />
Job Code:
<asp:Label id="Job_CodeLabel" runat="server" Text='<%# Eval("Job_Code") %>' />
<br />
TWA:
<asp:Label id="TWALabel" OnDataBinding="ListView2_DataBinding" runat="server" Text='<%# Eval("TWA") %>' />
<br />
Job Classification:
<asp:Label id="Job_ClassificationLabel" runat="server" Text='<%# Eval("Job_Classification") %>' />
<br />
Job Function:
<asp:Label id="Job_FunctionLabel" runat="server" Text='<%# Eval("Job_Function") %>' />
<br />
Job Description:
<asp:Label id="Job_DescriptionLabel" runat="server" Text='<%# Eval("Job_Description") %>' />
<br />
<br />
</span>
</ItemTemplate>
<LayoutTemplate>
<div id="itemPlaceholderContainer" runat="server" style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align:center; border:3em; border-color:black;">
<span runat="server" id="itemPlaceholder" />
</div>
<div style="text-align: left;background-color: white;font-family: Verdana, Arial, Helvetica, sans-serif;text-decoration:underline ;color: #FFFFFF;" >
</div>
</LayoutTemplate>
<SelectedItemTemplate>
<span style="background-color: white;font-weight: bold;color: #333333;">
<u>Plant Name</u>:
<asp:Label id="PlantLabel" runat="server" Text='<%# Eval("Plant") %>' />
<br />
Department #:
<asp:Label id="column1Label" runat="server" Text='<%# Eval("column1") %>' />
<br />
Department Name:
<asp:Label id="GroupLabel" runat="server" Text='<%# Eval("Group") %>' />
<br />
Job Code:
<asp:Label id="Job_CodeLabel" runat="server" Text='<%# Eval("Job_Code") %>' />
<br />
TWA:
<asp:Label id="TWALabel" runat="server" Text='<%# Eval("TWA") %>' />
<br />
Job Classification:
<asp:Label id="Job_ClassificationLabel" runat="server" Text='<%# Eval("Job_Classification") %>' />
<br />
Job Function:
<asp:Label id="Job_FunctionLabel" runat="server" Text='<%# Eval("Job_Function") %>' />
<br />
Job Description:
<asp:Label id="Job_DescriptionLabel" runat="server" Text='<%# Eval("Job_Description") %>' />
<br />
<br />
</span>
</SelectedItemTemplate>
</asp:ListView>
<script runat="server">
protected void ListView2_DataBinding(object sender, EventArgs e)
{
Label lbl = (Label)(sender);
int TWA = (int)(Eval("TWA"));
lbl.Text = TWA.ToString();
if (TWA >= 85)
{
if (TWA < 90)
{
lbl.CssClass = "YellowThis";
}
else
{
lbl.CssClass = "RedThis";
}
}
else
{
lbl.CssClass="GreenThis";
}
}
</script>
You could do it in your code behind. Iterate through your list items.
protected void add_color()
{
foreach(ListItem li in ListView2.Items)
{
Label your_label = (Label)li.FindControl" your_label_name";
int TWA = Convert.ToInt32(your_label);
if (TWA > 90)
{
your_label.BackColor = System.Drawing.Color.Yellow
}
}
}
This questions is more than 1 year old and I'm not sure if it'll help anyone here.
I think what went wrong in your code is because your listview databinding event was created in Label instead of creating it in the Listview.
What you can do is create a databinding event in ListView control and read the value of the TWA label and then set your ListView control background color.
I am using the Telerik radlistview o display some results, i perform some grouping in my query and return a sorted and ordered resultset and set it to the datasource. For some reason (which i have been battling with all morning) the ListView re-orders the results by the ID column.
<telerik:RadListView runat="server" ID="rlThumbnailView" OnNeedDataSource="rlThumbnailView_NeedDataSource"
AllowPaging="true" PageSize="8" OnDataBound="rlThumbnailView_DataBound" OnItemDataBound="rlThumbnailView_ItemDataBound">
<LayoutTemplate>
<span style="vertical-align: top; position: relative; top: 4px">Displaying page
<%#Container.CurrentPageIndex + 1 %>
of
<%#Container.PageCount %></span> </span>
<br />
<div id="list">
<asp:Panel runat="server" ID="Panel1" Style="float: left; margin-left: 160px" Visible="<%#Container.PageCount > 1 %>">
<asp:Button runat="server" ID="PrevButton" CommandName="Page" CommandArgument="Prev"
Text="Prev Page" Enabled="<%#Container.CurrentPageIndex > 0 %>" />
<asp:Button runat="server" ID="NextButton" CommandName="Page" CommandArgument="Next"
Text="Next Page" Enabled="<%#Container.CurrentPageIndex < Container.PageCount - 1 %>" />
</asp:Panel>
<div>
<telerik:RadSlider runat="server" ID="RadSlider1" MaximumValue="3" MinimumValue="1"
Value="2" LiveDrag="false" SmallChange="1" AutoPostBack="true" OnValueChanged="RadSlider1_ValueChanged"
Width="150px" CausesValidation="false" />
</div>
<div style="clear: both;">
</div>
<asp:Panel ID="itemPlaceholder" runat="server">
</asp:Panel>
<div style="clear: both;">
</div>
</div>
</LayoutTemplate>
<ItemTemplate>
<div id="wrapper" runat="server" style="float: left; margin-top: 2px; margin-bottom: 2px;">
<telerik:RadBinaryImage ID="ThumnailImage1" runat="server" />
UPC:
<asp:Label ID="lblUPC" runat="server"></asp:Label><br />
Description:
<asp:Label ID="lblDescription" runat="server"></asp:Label>
<br />
<div id="dvCountries" runat="server">
Languages:</div>
Changes:<asp:Label ID="lblChanges" runat="server"></asp:Label>
<br />
Pack Format:<asp:Label ID="lblPackType" runat="server"></asp:Label>
<br />
Date Completed:<asp:Label ID="lblDateCompleted" runat="server"></asp:Label>
<br />
</div>
</div>
</ItemTemplate>
</telerik:RadListView>
I beleive this is based on the standard microsoft listview,
For anybody who faces the same issue, the answer appears here:
http://www.telerik.com/community/forums/aspnet-ajax/listview/listview-paging-and-sortorder.aspx
seems to be a bug with Telerik
I've a got ListBox called lbxUpcommingEvents. When the index is changed the event handler is fired to check for duplicate records. If duplicates are not found, a panel called pnlAction inside a formview is turned on by the way of display style. If dups are found another panel pnlActionCancel is turned on and the oter is tuned off. Basically a toogle effect.
I've tried the visible property, viewstate property, but it does not work and I can't figure it out so once again, I seek wizdom from the collective. Here is my code.
protected void lbxUpcommingEvents_OnSelectedIndexChanged(object sender, EventArgs e)
{
pnlEventsSignUp.Visible = true;
string _selectedItemValue = lbxUpcommingEvents.SelectedValue.ToString();
int _eventid = Convert.ToInt32(_selectedItemValue);
Guid _memberId = Guid.Empty;
_memberId = new Guid(Session["myId"].ToString());
// Check for existing signup
EventsMemberSignup _createSingup = new EventsMemberSignup();
dsEventsSingupTableAdapters.MemberEventsTableAdapter da = new dsEventsSingupTableAdapters.MemberEventsTableAdapter();
dsEventsSingup.MemberEventsDataTable dt = da.GetDataForDupCheck(_memberId, _eventid);
if (dt.Rows.Count == 1)
{
Panel pnlAction = (Panel)(fvEventSignUp.FindControl("pnlAction"));
//pnlAction.Visible = false;
pnlAction.Style.Add("display","none");
Panel pnlActionCancel = (Panel)(fvEventSignUp.FindControl("pnlActionCancel"));
//pnlActionCancel.Visible = true;
pnlActionCancel.Style.Remove("display");
}
else
{
Panel pnlActionCancel = (Panel)(fvEventSignUp.FindControl("pnlActionCancel"));
//pnlActionCancel.Visible = false;
pnlActionCancel.Style.Add("display", "none");
Panel pnlAction = (Panel)(fvEventSignUp.FindControl("pnlAction"));
//pnlAction.Visible = true;
pnlAction.Style.Remove("display");
}
}
<div id="columnleft">
<a name="content_start" id="content_start"></a>
<div class="leftblock">
<h2>Events Signup</h2>
<p>
</p>
<h3> Upcomming Events</h3>
<p>
<asp:ListBox ID="lbxUpcommingEvents" runat="server" DataSourceID="odsUpcommingEvents"
Rows="6" DataTextField="Title" DataValueField="id" AutoPostBack="true"
Width="206px" OnSelectedIndexChanged="lbxUpcommingEvents_OnSelectedIndexChanged" />
</p>
<h3> Members Attending</h3>
<p>
<asp:DataGrid ID="lboxSignedUpMembers" runat="server" DataSourceID="odsSignedUpMembers"
AutoPostBack="true" AutoGenerateColumns="false" RowStyle-CssClass="gridview" AlternatingRowStyle-CssClass="altbgcolor"
Width="206px" onselectedindexchanged="lboxSignedUpMembers_SelectedIndexChanged" CssClass="gridview"
GridLines="None" BorderStyle="Solid" BorderWidth="1" BorderColor="Black" >
<AlternatingItemStyle BackColor="White" />
<Columns>
<asp:BoundColumn DataField="Name" />
<asp:BoundColumn DataField="Title" />
<asp:TemplateColumn >
<ItemTemplate>
<asp:Label runat="server" ID="lblDate" Text='<%# Eval("StartTime", "{0:d}") %>' />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</p>
</div>
</div>
</td>
<td align="left" >
<!--Start of right column-->
<div id="columnright">
<div class="rightblock">
<asp:Panel ID="pnlEventsSignUpTitle" runat="server" CssClass="actionbuttons">
<h2>Select an Event to Signup</h2>
</asp:Panel>
<asp:Label runat="server" ID="lblNote" ForeColor="#cc0000" Font-Bold="true" />
</div>
<div class="rightblock">
<asp:Panel runat="server" ID="pnlEventsSignUp" visible="false">
<div class="dashedline" ></div>
<asp:FormView ID="fvEventSignUp" runat="server" DataSourceID="ObjectDataSource1"
DataKeyNames="id" Width="100%" >
<ItemTemplate>
<h2>
<asp:HiddenField runat="server" ID="hfEventID" Value='<%# Eval("id") %>' />
<asp:Label Text='<%# Eval("title") %>' runat="server" ID="titleLabel" />
</h2>
<div class="itemdetails">
<br />
location:
<h3>
<asp:Label ID="locationLabel" runat="server" Text='<%# ShowLocationLink(Eval("locationname"),Eval("location")) %>' />
</h3>
<p>
<asp:Label Text='<%# Eval("starttime","{0:D}") %>' runat="server" ID="itemdateLabel" CssClass="GeneralText" />
<asp:Label Text='<%# ShowDuration(Eval("starttime"),Eval("endtime")) %>' runat="server" ID="Label1" CssClass="GeneralText" />
</p>
</div>
<div class="downloadevent">
<a href="#">
<img src="images/icon_download_event.gif" alt="Download this event to your personal calendar"
width="15" height="26" /></a><a href='<%# "events_download.ashx?EventID=" + Convert.ToString(Eval("id")) %>'>Add
this event to your personal calendar</a>
</div>
<Club:ImageThumbnail ID="thumb1" runat="server" ImageSize="Large" PhotoID='<%# Eval("photo") %>' />
<p>
<asp:Label Text='<%# Eval("description") %>' runat="server" ID="descriptionLabel" />
</p>
<div class="dashedline" ></div>
<asp:Panel ID="pnlAction" runat="server" CssClass="actionbuttons" >
<table border="0" cellpadding="2" cellspacing="2">
<tr>
<td>
<asp:Label runat="server" ID="Label2" Text="Action<br />Required" Width="80px" Font-Bold="true"
ForeColor="#cc0000" Font-Size="14px" />
</td>
<td>
<img src="images/RedArrow.jpg" alt="Red Arrow Right" />
</td>
<td>
<asp:CheckBox runat="server" ID="cbxCert" Height="30px" Text="Check to Confirm Attendance" /><br />
<asp:CustomValidator runat="server" ID="rfvConfirm"
ErrorMessage="You must check the box to continue" Font-Bold="true"
ForeColor="#cc0000" ClientValidationFunction="ensureChecked" /> <br />
<Club:RolloverLink ID="rlnkSignUp" runat="server" Text = "I will be attending this event"
OnClick="rlnkSignUp_OnClick" ToolTip="I hereby certify that I am commiting to attending this event."
/>
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel runat="server" ID="pnlActionCancel" CssClass="actionbuttons" >
<table border="0" cellpadding="2" cellspacing="2">
<tr>
<td>
<asp:Label runat="server" ID="lblDupSignup" Text="You are alredy signed up for this event" ForeColor="#cc0000" Font-Bold="true" Font-Size="14px" />
</td>
<td>
</td>
<td>
<asp:CheckBox runat="server" ID="cbxCancel" Height="30px" Text="Check to Cancel Attendance" /><br />
<asp:CustomValidator runat="server" ID="CustomValidator1"
ErrorMessage="You must check the box to continue" Font-Bold="true"
ForeColor="#cc0000" ClientValidationFunction="ensureChecked" /> <br />
<Club:RolloverLink ID="rlnCancel" runat="server" Text="I'm cancelling my participation"
OnClick="rlnCancel_OnClick" />
</td>
</tr>
</table>
</asp:Panel>
</ItemTemplate>
</asp:FormView>
</asp:Panel>
</div>
I've set the ViewStateMode to "Disabled". I'm just hoping it won't back fire somewhere else.
Your existing code might work if you drop an update panel and place your controls inside it.
Alternatively you can create a property in your page like
private bool myRowCount;
protected bool HasRowsMyData
{
get { return myRowCount; }
set { myRowCount=value; }
}
Then inside your selectedIndex change event
if (dt.Rows.Count == 1)
{
HasRowsMyData=true;
//DataBind your controls here
YourUpdatePanel.Update();
}
Inside your aspx on panels you can set each panel's visible property like this so whenever page is updated they will turn on/off depeding upon the result
Visible='<%#HasRowsMyData%>'
Visible='<%#!HasRowsMyData%>'
If you like to do it client side I advise jQuery's toggle function
jQuey:toggle()
I have a listview control that is nested in the item template of another listview control that i'm trying to reference in codebehind using the .FindControl() method, but it keeps returning null. After get this to work, I'll need to reference a ComboBox inside of the inner listview. Here is where I am so far:
ListView lsvTickets
ItemTemplate
Listview lsvActions
ItemTemplate
ComboBox cboAssignees
I'm using the following code to attempt the reference in code behind:
var actions = (RadListView)lsvTickets.FindControl("lsvActions");
But this is returning null. I thought I would only have to do something like this to achieve the final desired result:
var assignees = (RadComboBox)lsvTickets.FindControl("lsvActions").FindControl("cboAssignees")
Can anyone help? What am I doing wrong here? Here's the full layout for those of you it would help:
<rad:RadListView runat="server" ID="lsvTickets">
<ItemTemplate>
<div id="divContainer" class="divContainer">
<div id="divTicketHeader" class="divTicketHeader">
<asp:Table runat="server" ID="tblTicketHead" Width="100%" CellSpacing="0" CellPadding="5" HorizontalAlign="Center">
<asp:TableRow HorizontalAlign="Center">
<asp:TableCell Width="25%">
<asp:Label ID="Label1" runat="server" Text='<%#Eval("Subject") %>' Font-Bold="true" />
</asp:TableCell><asp:TableCell Width="25%">
<asp:Label ID="Label2" runat="server" Text='<%#Eval("Status.Key") %>' />
</asp:TableCell><asp:TableCell Width="25%">
<asp:Label ID="Label3" runat="server" Text='<%#Eval("Ticket.Reported_By") %>' />
</asp:TableCell><asp:TableCell Width="25%">
<asp:Label ID="Label4" runat="server" Text='<%#Eval("DateOpened") %>' />
</asp:TableCell></asp:TableRow></asp:Table></div>
<div id="divTicketBody" class="divComments">
<rad:RadListView runat="server" ID="lsvActions" DataSource='<%#Eval("TicketActions") %>'>
<ItemTemplate>
<center>
<div id="divAddComment" style="width: 500px;">
<div id="divCommentControls" style="margin: 8px 0px 8px 0px;">
<rad:RadComboBox runat="server" ID="cboStatus" DataSource='<%#GetStatuses() %>' DataTextField="Status" DataValueField="ID" /> <rad:RadComboBox runat="server" ID="cboAssignTo" DataSource='<%#GetAssignees() %>' DataTextField="Key" DataValueField="Value" />
</div>
<rad:RadTextBox runat="server" ID="txtComment" TextMode="MultiLine" Width="500" Height="100" CssClass="commentBox" /><br />
<div style="height: 35px;">
<div style="float:left"><asp:CheckBox ID="cbMakeITTicket" runat="server" Text="Convert to IT Support Ticket" /></div>
<div style="float:right; margin: 3px 0 0 0; "><rad:RadButton runat="server" ID="btnSubmit" Text="Submit" CssClass="buttonTag" /></div>
</div>
</div>
</center>
<div id="divComment" class="divComment">
<asp:Table runat="server" ID="tblComment" CellPadding="5">
<asp:TableRow>
<asp:TableCell Width="15%" HorizontalAlign="Center">
<rad:RadBinaryImage runat="server" ID="imgCommenter" Width="50" Height="50" /><br />
<asp:Label ID="Label5" runat="server" Text="[action author]" CssClass="commenterText" /><br />
<asp:Label ID="Label6" runat="server" Text='<%#Eval("Action_Date", "{0:MMM d, yyy hh:mm}") %>'
CssClass="commenterText"/><br />
</asp:TableCell><asp:TableCell>
<asp:Label ID="Label7" runat="server" Text='<%#Eval("Description") %>' />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</ItemTemplate>
</rad:RadListView>
</div>
</div>
</ItemTemplate>
</rad:RadListView>
</asp:Content>
You're looking for a combobox in a control that potentially has many lines (thus rows of combobox instances ) - it doesn’t know which one you’re looking for.
Obviously I don’t know what you need to do to the combobox but you should look at
alternate approaches.
Take a look at using the OnItemDataBound event of lsvActions
Then add code such as …
protected void lsvActions_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
RadComboBox myCBO = (RadComboBox)item.FindControl("cboStatus")
myCBO.Visible = false;
}
}
...also, just a general tip, I usually find using OnNeedDataSource to load RadGrids and ListViews saves a lot of headaches.
Hope that helps.