Hi All,
I am trying to access the multiple items selected in the List Box (lblgrideditcountry) which is in template field of Grid view. The list box will be available only in editing event as its placed as edit template in grid view, but I am not successful in doing so.
</asp:TemplateField>
<asp:TemplateField HeaderText=" Country">
<EditItemTemplate>
<asp:Label ID="lblgrideditcountry" runat="server" CssClass="clslabel"
Text='<%# Bind("AM_AuditCountry") %>'></asp:Label>
<br />
<asp:ListBox ID="lstgridcountry" runat="server" AutoPostBack="True"
DataSourceID="dsCountryName" DataTextField="CountryName"
DataValueField="CountryName" Height="65px"
onselectedindexchanged="lstgridcountry_SelectedIndexChanged"
SelectionMode="Multiple" Width="180px"></asp:ListBox>
<br />
I have tried using the following the code
{
gridamIU.EditIndex = e.NewEditIndex;
gridfill(gridamIU);
SeltlstCountry=(ListBox)( gridamIU.Rows[gridamIU.EditIndex].FindControl("lstgridcountry"));
SeltlstLocation = (ListBox)gridamIU.Rows[gridamIU.EditIndex].FindControl("lstgridlocation");
}
protected void lstgridcountry_SelectedIndexChanged(object sender, EventArgs e)
{
string strSelectedItems = "";
strSelectedItems= ReadSelectedListItems(SeltlstCountry);
objDataBoundBL.ListBoxValueTextWithParameter_AR("SPR_Eaudit_AM_AuditItem", SeltlstLocation, "Audit Facility", strSelectedItems, ConfigurationManager.AppSettings["ConEaudit"].ToString());
//foreach (System.Web.UI.WebControls.GridViewRow dg in gridamIU.Rows)
//{
// strSelectedItems = ReadSelectedListItems(((ListBox)dg.Cells[3].FindControl("lstgridcountry")));
//}
}
Please help me...
T.Chaitanya kumar