asp:listview and refresh list after posting to SQL DB - asp.net

I have created a listview based on the below data:
<div class="showJournals">
<asp:ListView ID="ListJournal" runat="server" DataSourceID="journalData" >
<EmptyDataTemplate>
<table runat="server" style="">
<tr>
<td>Finner ingen journaler.</td>
</tr>
</table>
</EmptyDataTemplate>
<ItemTemplate>
<tr style="">
<td class="navn">
<%# Eval("journalSentBy") %>
<%# Eval("journalrecvdBy") %>
</td>
<td class="text">
<asp:Label ID="journalTextLabel" runat="server" Text='<%# Eval("journalText") %>' />
</td>
<td>
<asp:Label ID="journalDateLabel" runat="server" Text='<%# Eval("journalDate") %>' />
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table id="itemPlaceholderContainer" runat="server" style="" cellpadding="0" cellspacing="0" border="0">
<tr runat="server" style="">
<th runat="server" class="navn">Navn</th>
<th runat="server" class="text">Journaltekst</th>
<th runat="server">Dato</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
<asp:SqlDataSource ID="journalData" runat="server" ConnectionString="<%$ ConnectionStrings:S2000ConnectionString %>" SelectCommand="SELECT [journalSentBy], [journalrecvdBy], [journalText], [journalDate] FROM [TBL_CASE_JOURNAL] WHERE ([journalCaseId] = #journalCaseId) ORDER BY [journalDate] DESC">
<SelectParameters>
<asp:ControlParameter ControlID="txtcase" Name="journalCaseId" PropertyName="Text" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</div>
My problem comes when i have created a function to insert New lines into the DB table and goes back to the listview, i cant get the list to be refreshed With the New data. Is there some commands or possible to create a function to handle this? Many thanks for any response concerning this!

At the end of your function add:
ListJournal.DataBind();
It should work.

Related

how to use edit radlistview contain combobox

I have problem with edit of radlistview.
in edit radlistview contain combobox.
How to I set value for combobox and update value of edit radlistview to database.
I have code asp.net:
<telerik:RadListView ID="RadListView2" runat="server" Width="100%" DataSourceID="SqlDataSource2" AllowPaging="True" PageSize="5" DataKeyNames="bc_truongcap">
<LayoutTemplate>
<div class="RadListView RadListView_Default">
<table style="width: 100%;">
<thead>
<tr class="rlvHeader">
<td>Chỉnh sửa
</td>
<td>Trường</td>
<td>Khối ngành</td>
</tr>
</thead>
<tfoot>
<tr>
<td>
<telerik:RadDataPager ID="RadDataPager1" runat="server" PageSize="3">
<Fields>
<telerik:RadDataPagerButtonField FieldType="Numeric" />
</Fields>
</telerik:RadDataPager>
</td>
</tr>
</tfoot>
<tbody>
<tr id="itemPlaceholder" runat="server">
</tr>
</tbody>
</table>
</div>
</LayoutTemplate>
<ItemTemplate>
<tr class="rlvI">
<td>
<asp:LinkButton ID="LinkButton1" CommandName="Edit" runat="server">Đổi</asp:LinkButton></td>
<td><%#Eval("bc_truongcap") %></td>
<td><%#Eval("bc_loaibang") %></td>
</tr>
</ItemTemplate>
<EditItemTemplate>
<tr class="rlvIEdit">
<td>
<fieldset>
Thay đổi Bằng
<table>
<tr>
<td>Trường cấp</td>
<td><%#Eval("bc_truongcap") %></td>
</tr>
<tr>
<td>Loại bằng</td>
<td>
<telerik:RadComboBox ID="bangcap" Text='<%#Bind("bc_truongcap")%>' runat="server" Skin="Office2007">
<Items>
<telerik:RadComboBoxItem runat="server" Text="Phổ thông" Value="Phổ thông" Selected='<%#Eval("bc_truongcap") =="Phổ thông" ? true :false %>' />
<telerik:RadComboBoxItem runat="server" Text="Trung cấp" Value="Trung cấp" Selected='<%#Eval("bc_truongcap") =="Trung cấp" ? true :false %>' />
<telerik:RadComboBoxItem runat="server" Text="Cao đẳng" Value="Cao đẳng" />
<telerik:RadComboBoxItem runat="server" Text="Đại học" Value="Đại học" />
<telerik:RadComboBoxItem runat="server" Text="Thạc sĩ" Value="Thạc sĩ" />
<telerik:RadComboBoxItem runat="server" Text="Khác" Value="Khác" />
</Items>
</telerik:RadComboBox>
<%--<asp:TextBox ID="TextBox2" runat="server" Text='<%#Bind("bc_loaibang") %>'>
</asp:TextBox>--%></td>
</tr>
<tr>
<td>
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="update">Cập nhập</asp:LinkButton></td>
<td>
<asp:LinkButton ID="LinkButton3" runat="server" CommandName="cancel">Thoát</asp:LinkButton></td>
</tr>
</table>
</fieldset>
</td>
</tr>
</EditItemTemplate>
<EmptyDataTemplate>
<div class="RadListView RadListView_Default">
<div class="rlvEmpty">
Chưa có cập nhập băng cấp.
</div>
</div>
</EmptyDataTemplate>
</telerik:RadListView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:InterFindWorkConnectionString %>"
SelectCommand="SELECT id_nganh, bc_truongcap, bc_loaibang FROM BangCap WHERE (id_gmailntv = #id_gmailntv) AND (bc_status = 0)" UpdateCommand="Update Bangcap set bc_truongcap=#bc_truongcap , bc_loaibang = #bc_loaibang where bc_truongcap=#bc_truongcap ">
<SelectParameters>
<asp:SessionParameter Name="id_gmailntv" SessionField="user" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="bc_truongcap" />
<asp:Parameter Name="bc_loaibang" />
</UpdateParameters>
</asp:SqlDataSource>
how to update to database with value of selected combobox?
Check the Two-Way DataBinding in ListView thread in the Telerik KB.

Get the id of parent listview in child listview checkbox change event

On chkSubModuleView_CheckedChanged() event iwant to get the id of chkModule.Please tell me how to get the id or reference of parent checkbox on click of child checkbox in server side.How to distinguish between different modules .
enter code here
<asp:ListView ID="lvModule" runat="server">
<LayoutTemplate>
<table width="600px" border="0" cellpadding="0" cellspacing="0"
class="ListViewtable">
<tr>
<th style="width: 10%;">
Modules
</th>
</tr>
<asp:PlaceHolder ID="itemPlaceholder" runat="server">
</asp:PlaceHolder>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<asp:CheckBox ID="chkModule" runat="server"
CausesValidation="false" AutoPostBack="true"
OnCheckedChanged="chkModule_CheckedChanged" >
</asp:CheckBox><asp:HiddenField ID="hfEntityName"
Value='<%# Eval("EntityName") %>' runat="server" />
<%# Eval("Title")%>
<asp:HiddenField ID="hfID" Value='<%# Eval("ID") %>'
runat="server" />
<asp:Label ID="label" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td colspan="2" style="padding-left: 20px;">
<asp:ListView ID="lvSubModule" runat="server">
<LayoutTemplate>
<table width="100%" cellspacing="0" border="0"
class="ListViewtableLayer2">
<tr>
<th style="width: 20%;">
Sub Module
</th>
<th style="width: 20%;">
<asp:CheckBox ID="chkSubModuleView"
Checked="true" runat="server" AutoPostBack="true"
OnCheckedChanged="chkSubModuleView_CheckedChanged" />
View
</th>
</tr>
<asp:PlaceHolder ID="itemPlaceholder"
runat="server"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<%# Eval("Title")%>
<asp:HiddenField ID="hfMenuID" Value='<%#
Eval("MenuID") %>' runat="server" />
<asp:HiddenField ID="hfName" Value='<%#
Eval("HeaderID") %>' runat="server" />
</td>
<td>
<asp:CheckBox ID="chkRead" runat="server"
AutoPostBack="true" Checked="true" CausesValidation="false"
OnCheckedChanged="chkRead_CheckedChanged"></asp:CheckBox>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
change your checkbox property to
<asp:CheckBox ID="chkSubModuleView"
Checked="true" runat="server" AutoPostBack="true" Key='<%# Eval("ID")%>'
OnCheckedChanged="chkSubModuleView_CheckedChanged" />
In your .cs
protected void chkSubModuleView_CheckedChanged(object sender, EventArgs e)
{
CheckBox chk = (CheckBox)sender;
string yourID = chk.Attributes["Key"].ToString();
}

Dynamic TabPanels with nested listviews (having dynamic items) asp.net

I have TabControl(AjaxToolKit) having 2 Nested ListViews.
code:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TabContainer ID="tcQuestions" runat="server" ActiveTabIndex="0" OnDemand="true" AutoPostBack="false" TabStripPlacement="Top" ScrollBars="None" UseVerticalStripPlacement="false">
<asp:TabPanel ID="tpFirst" runat="server" HeaderText="Page 1" Enabled="true" ScrollBars="Auto"
OnDemandMode="Once">
<ContentTemplate>
<asp:Panel ID="pnlNoData" runat="server">
<asp:LinkButton ID="lbQuestionsAdd" Text="Add Question" runat="server" />
</asp:Panel>
<asp:Panel ID="pnlListView" runat="server">
<asp:ListView ID="lsvQuestions" runat="server" ItemPlaceholderID="phItemPlaceHoler">
<EmptyDataTemplate>
<em>NO RECORD WAS FOUND</em>
</EmptyDataTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label ID="lblQuestionID" Text='<%#Eval("intQuesId") %>' Visible="false" runat="server" />
<asp:Label ID="lblQuestionTitle" Text='<%#Eval("strQuesTitle") %>' runat="server" />
<%--1.Are you doing job?--%>
</td>
</tr>
<%--Inner Listview--%>
<asp:ListView ID="lsvAnswers" runat="server" ItemPlaceholderID="phItemPlaceHolerAnswers">
<LayoutTemplate>
<table runat="server" id="table1">
<tr runat="server" id="phItemPlaceHolerAnswers">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<asp:PlaceHolder ID="plControl" runat="server" />
</td>
</tr>
</ItemTemplate>
<EmptyDataTemplate>
<em>NO RECORD WAS FOUND</em>
</EmptyDataTemplate>
</asp:ListView>
</ItemTemplate>
<LayoutTemplate>
<table class="tblAll">
<tbody>
<tr>
<td style="width: 125px">
<asp:LinkButton ID="lbtnAddQuestions" runat="server">Add Questions</asp:LinkButton>
</td>
<td style="width: 316px">
<asp:LinkButton ID="lbtnDesignTools" runat="server">Design Tools</asp:LinkButton>
</td>
<td class="formTopLinks">
<img class="imgicons" src="../Layout/images/edit.png" />
<asp:LinkButton ID="lbEditProperties" runat="server" CssClass="lnkbuttonText">Edit Properties</asp:LinkButton>
</td>
<td class="formTopLinks">
<img class="imgicons" src="../Layout/images/Delete.png" />
<asp:LinkButton ID="lbCopyPage" runat="server" CssClass="lnkbuttonText">Copy Page</asp:LinkButton>
</td>
<td class="formTopLinks">
<img class="imgicons" src="../Layout/images/Copy.png" />
<asp:LinkButton ID="lbDeletePage" runat="server" CssClass="lnkbuttonText">Delete Page</asp:LinkButton>
</td>
<td style="width: 20px;">
<img class="imgicons" src="../Layout/images/left.png" />
</td>
<td style="width: 64px;">
<asp:Label ID="Label1" runat="server" CssClass="lnkbuttonText" Text="Move Page" />
</td>
<td style="width: 20px;">
<img class="imgicons" src="../Layout/images/right.png" />
</td>
<td>
 
</td>
</tr>
</tbody>
</table>
<br />
<table class="tblAll">
<tbody>
<asp:PlaceHolder ID="phItemPlaceHoler" runat="server"></asp:PlaceHolder>
</tbody>
</table>
</LayoutTemplate>
</asp:ListView>
</asp:Panel>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
Where, I am getting Question from Table "Question", and its answers from another table "Answers". Each Question is linked with a PageNumber.
so, i have to create TabPanels according to PageNumber from Question, Then Bind Question Label with that Question, and fill 2nd ListView with Answers of that Question.
These answers are dynamic controls based on db entries e.g textbox, checkboxlists, radiobutton lists and may vary for every question.
Now what i am doing is copying tabPanel 1 to new TabPanel and adding question and answers according to db values, but when i am creating 2nd TabPanel, it give me error that
Cannot unregister UpdatePanel with ID 'ContentPlaceHolder1_tcQuestions_tpFirst_updatePanel' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
What is the best approach to handle this scenerio.
something like SurverMonkey except i am using tabs for new page.

Nested Repeaters

i am having some trouble with repeaters each. i am trying to repeat a list of appliances under a unique categories from my database. the category names repeat allright but the appliance names repeat for all the categories(meaning all categories have the same appliances) i used a nested repeater for the appliances i do not know if that is the problem.
<%# Page Title="" Language="VB" MasterPageFile="~/public.master" AutoEventWireup="false" CodeFile="ccalc.aspx.vb" Inherits="ccalc" %>
<%# Import Namespace="System.Data" %>
<%# Import Namespace="System.Data.OleDb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<div>
<h1>Estimated Monthly Electricity Consumption Calculator</h1>
</div>
<div>
<asp:Repeater ID="myRepeater" runat="server">
<ItemTemplate>
<table width="100%" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF" class="ten">
<tbody>
<tr>
<td colspan="5"><h2>
<asp:Label ID="catid" runat="server" Text='<%#Eval("CategoryID") %>'></asp:Label>
<asp:Label ID="Catname" runat="server" Text='<%#Eval ("CategoryName") %>'></asp:Label></h2>
</td>
</tr>
<tr align="center">
<th class="style1" bgcolor="#FFCC66">Electrically Powered Items</th>
<th class="ten" bgcolor="#FFCC66"><div align="center">Quantity</div></th>
<th class="ten" bgcolor="#FFCC66"><div align="center">Average
monthly KWh</div></th>
<th class="ten" bgcolor="#FFCC66"><div align="center">KWh/month</div></th>
<th class="ten" bgcolor="#FFCC66"><div align="center">GHc /month</div></th>
</tr>
<asp:Repeater ID="innerRepeater" runat="server" DataSource = <%# sqldatasource3%> >
<ItemTemplate >
<tr>
<td class="style1"><strong>
<asp:Label ID="appName" runat="server" Text='<%#Eval ("ApplianceName") %>'></asp:Label></strong></td>
<td class="highlight"><div align="center">
<asp:TextBox ID="quantity" runat="server" AutoPostBack="True" CssClass="input"
Width="79px" ></asp:TextBox>
</div></td>
<td><div align="center">
<input name="refrigeratorMonthKWh" value="182" type="hidden" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div></td>
<td><div align="center">
<asp:TextBox ID="kwh" runat="server" CssClass="input4" Width="59px"></asp:TextBox>
</div></td>
<td><div align="center">
<asp:TextBox ID="ghc" runat="server" CssClass="input4" Width="59px"></asp:TextBox>
</div></td>
</tr>
</ItemTemplate>
</asp:Repeater>
<%
'End While
'brb.Dispose()
'br.Close()
%>
</tbody>
</table>
</ItemTemplate>
</asp:Repeater>
<%
'End While
'cmd.Dispose()
'dr.Close()
%>
</div>
<%
%>
<div>
<table width="100%" border="0" cellpadding="5" bgcolor="#FFF7E5" class="ten">
<tbody>
<tr>
<td><font color="#9f7f40">Estimated</font> monthly <u><font color="#FF0000">household </font></u>*
usage:
<asp:TextBox ID="totalusage" runat="server" CssClass="input4" Width="59px"></asp:TextBox>
kWh; <br /></td>
</tr>
<tr>
<td class="highlight"><font color="#9f7f40">Estimated</font> monthly <u><font color="#FF0000">household</font></u>*
bill: ¢
<asp:TextBox ID="totalbill" runat="server"
CssClass="input4" Width="59px"></asp:TextBox>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
SelectCommand="SELECT * FROM [DeviceCategory]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
SelectCommand="SELECT * FROM [Appliances] where ([CategoryID]=[CategoryID])">
<%--<SelectParameters>
<asp:ControlParameter ControlID=myRepeater.innerrepeater.catid Name="catid" PropertyName="Text"
Type="String" />
</SelectParameters>--%>
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td class="highlight"><h3><strong><em>*Heating usage
not included in household totals</em></strong></h3></td>
</tr>
</tbody>
</table>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
The SQL data source
<asp:SqlDataSource ID="SqlDataSource2"
Should be outside of repeater.

asp.net listview and findcontrol

I have listview and i need to bind the dropdown list in the list view to ListItemCollection which will be built using a function BindPages().
When I clicked on the AddNew Link I am not able to bind the dropdown.
<asp:ListView DataKeyNames="Menuid" OnItemCommand="lvParentMenus_ItemCommand" OnSorting="lvParentMenus_Sorting"
OnDataBound="lvParentMenus_DataBound" DataSourceID="SqlDataSource1" ID="lvParentMenus"
runat="server">
<LayoutTemplate>
<table border="0" id="listview" width="100%" class="grid" cellpadding="0" cellspacing="0">
<thead>
<tr class="listingheader ">
<td width="10%" style="text-align: center; !important">
<input type="checkbox" name="checkbox" id="headercheck" />
</td>
<td id="thsno" runat="server">
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Sort" CommandArgument="Sno"
Text="Sno" />
</td>
<td id="thmenutext" runat="server">
<asp:LinkButton runat="server" ID="LinkButton2" Text="Menu Text" CommandName="Sort"
CommandArgument="MenuText" />
</td>
<td id="thmenuurl" runat="server">
<asp:LinkButton runat="server" ID="LinkButton3" Text="Menu Url" CommandName="Sort"
CommandArgument="MenuUrl" />
</td>
<td id="thlevel" runat="server">
<asp:LinkButton runat="server" ID="LinkButton4" Text="Level of Display" CommandName="Sort"
CommandArgument="level" />
</td>
<td>
Action
</td>
</tr>
</thead>
<tbody>
<tr runat="server" id="itemPlaceholder">
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3" align="center">
<asp:Label ID="lblMessage" Text="dfdfdfd" runat="server"></asp:Label>
</td>
<td align="right">
<asp:LinkButton Text="Add New" ID="lnkNew" CommandName="FillDropDown" runat="server"
Font-Bold="true" OnClick="AddNew"></asp:LinkButton>
</td>
</tr>
</tfoot>
</table>
<ItemTemplate>
<tr class='<%# Container.DataItemIndex % 2 == 0 ? "lrow1" : "lrow1 altrow" %>'>
<td class="col1" align="center">
<asp:CheckBox runat="server" ID="chkitem"></asp:CheckBox>
</td>
<td class="lrow1">
<%# Eval("Sno")%>
<asp:HiddenField ID="hdnStoreID" runat="server" Value='<%# Eval("MenuId") %>' />
</td>
<td>
<%# Eval("MenuText")%>
</td>
<td>
<asp:DropDownList ID="ddlPagesList" runat="server" DataSource='<%#BindPages()%>'>
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="ddlLevel" runat="server" DataSource='<%#BindLevel(6)%>' SelectedValue='<%# Eval("level")%>'>
</asp:DropDownList>
</td>
<td nowrap="nowrap">
<asp:LinkButton ID="lnkEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton>
|
<asp:LinkButton ID="lnkdelete" runat="server" CommandName="Delete" OnClientClick="javascript:return confirm('Are you sure to delete the current item');">Delete</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<InsertItemTemplate>
<tr class="lrow1">
<td class="col1" align="center">
</td>
<td class="lrow1">
</td>
<td class="lrow1">
<asp:TextBox ID="txtMenuText" runat="server" Width="80px" Text='<%# Eval("MenuText")%>'
CssClass="inputbox" ValidationGroup="InsertFields" />
<asp:RequiredFieldValidator ID="reqValidCity" ControlToValidate="txtMenuText" runat="server"
ErrorMessage="City Name is required." Display="Dynamic" ValidationGroup="InsertFields">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regValidCity" runat="server" ErrorMessage="Please Enter Alphabets only."
Display="Dynamic" ValidationGroup="g1" ControlToValidate="txtMenuText" ValidationExpression="^[a-zA-Z0-9\s]{2,1000}"></asp:RegularExpressionValidator>
</td>
<td>
<asp:DropDownList ID="ddlPagesList" runat="server" DataSource='<%#BindPages()%>'>
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="ddlLevel" runat="server" DataSourceID="sdsLevel" DataValueField="level"
DataTextField="level">
</asp:DropDownList>
</td>
<td nowrap="nowrap">
<asp:LinkButton ID="lnkinsert" runat="server" OnClick="lnkinsert_Click" ValidationGroup="InsertFields"> Insert</asp:LinkButton>
</td>
</tr>
</InsertItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="usp_getParentMenus"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="ddlRoles" Name="intRoleid" PropertyName="Text" DefaultValue="1"
ConvertEmptyStringToNull="true" Direction="Input" />
</SelectParameters>
</asp:SqlDataSource>
and here is the method BindPAges()
protected ListItemCollection BindPages()
{
string sDir = Request.PhysicalApplicationPath;
if (FirstCount == 0)
DirSearch(sDir);
return collection;
}
When I tried to find the ddlPageList in the AddNew() method it is throwing error "Object referenc not set "
AddNEw() Method:
` protected void AddNew(object sender, EventArgs e)
{
lvParentMenus.InsertItemPosition = InsertItemPosition.FirstItem;
lvParentMenus.FindControl("lnkNew").Visible = false;
lvParentMenus.EditIndex = -1;
sdsLevel.ConnectionString = DBConnectionString.ConnectionString;
Parameter a = new Parameter("intRoleid", DbType.Int32);
a.DefaultValue = ddlRoles.SelectedValue.ToString();
sdsLevel.SelectParameters.Add(a);
sdsLevel.SelectCommand = "usp_getParentMenus";
DropDownList ddlpages = (DropDownList)lvParentMenus.FindControl("ddlPagesList");
string sDir = Request.PhysicalApplicationPath;
DirSearch(sDir);
ddlpages.DataSource = collection;
ddlpages.DataBind();
}
Need urgently.
Thanks.
Please try
DropDownList ddlpages = (DropDownList)lvParentMenus.Items[0].FindControl("ddlPagesList");
Have you tried to use runat=server property in TABLE in Listview?

Resources