How to do file upload in a datalist? - c#

protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
FileUpload file = (FileUpload)DataList1.FindControl("FileUpload1");
file.SaveAs(Request.MapPath("//") + "resume//");
}
This is the datalist:
<asp:DataList ID="DataList1" runat="server" OnSelectedIndexChanged="DataList1_SelectedIndexChanged" OnItemCommand="DataList1_ItemCommand">
<ItemTemplate>
<div class="jumbotron">
<div class="card-primary">
<asp:LinkButton ID="job_pos" runat="server" Font-Size="XX-Large"><%#Eval ("JobPosition") %></asp:LinkButton>
<h4 style="font-weight: bolder"><%#Eval ("CompanyName") %> <span class="icon"><i class="fa fa-building"></i></span></h4>
<h5 style="font-weight: bold; color: #808080"><%#Eval ("Region") %> <span class="icon"><i class="fa fa-map-marker"></i></span></h5>
<h5 style="font-weight: bold; color: #808080"><%#Eval ("ExactAddress") %></h5>
<div>
<h5><%#Eval ("JobDesc") %></h5>
<div>
<asp:Label ID="Label2" runat="server" Text="Interested? Apply Now!" Font-Bold="True" ForeColor="Red"></asp:Label>
<asp:FileUpload ID="FileUpload1" runat="server" CssClass="primary"/>
<asp:Button ID="Button1" runat="server" Text="Upload Resume" OnClick="Button1_Click" CssClass="btn-primary" CommandName="UPDATE"/>
</div>
</div>
</div>
</div>
</ItemTemplate>
</asp:DataList>

Related

The modal pop up wont open after passing the values from repeater in asp.net

I have a search webpage where the user can apply for jobs. The jobs are displayed through repeater control. When the user clicks on apply button I want a modal to popup with two textboxes containing the companies email and the job name. Now when I am not passing passing at that time the modal pops up but when I try to pass values from repeater than the modal doesn't show up. I have searched a lot and even tried something. With what I have tried I am not getting an error but the modal is not showing up. Here is my code
.aspx code for repeater
<asp:Repeater ID="RepterDetails" runat="server" OnItemCommand="RepterDetails_ItemCommand">
<HeaderTemplate>
<table style="border:1px solid; width:800px" cellpadding="2" cellspaing="2">
<tr style=" color:#000000; font-size: large; font-weight: bold;">
<td colspan="2">
<b>JOBS Available</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<table style="border-top:3px solid; width:800px" >
<tr>
<td style="color:black" >
COMPANY:
<asp:Label ID="lblcmp" runat="server" Text='<%#Eval("cmp_name")%>' Font-Bold="true" ForeColor="black"/>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="color:black">
LOCATION:
<asp:Label ID="lbl_city" runat="server" Text='<%#Eval("city_name") %>' ForeColor="black"/>,
<asp:Label ID="lbl_state" runat="server" Text='<%#Eval("state_name") %>' ForeColor="black"/>
</td>
</tr>
<tr>
<td style="color:black">
Job:
<asp:Label ID="lbl_jname" runat="server" Font-Bold="true" Text='<%#Eval("job_name") %>' ForeColor="black"/>
</td>
</tr>
<tr>
<td style="color:black">
Job Details:
<asp:Label ID="lbl_jdet" runat="server" Text='<%#Eval("job_details") %>' ForeColor="black"/>
</td>
</tr>
<tr>
<td style="color:black">
Experience :
<asp:Label ID="lbl_jexp" runat="server" Text='<%#Eval("experience") %>' ForeColor="black"/>
</td>
</tr>
<tr>
<td style="color:black">
Job-Type :
<asp:Label ID="lbl_jobtype" runat="server" Text='<%#Eval("job_type") %>' ForeColor="black"/>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td style="color:black" >Comapny Email: <asp:LinkButton ID="link_cemail" runat="server" CommandName='<%#Eval("cemail") %>' CommandArgument='<%#Eval("cemail") %>' Text='<%#Eval("cemail") %>' ForeColor="black" OnClick="link_cemail_Click" ></asp:LinkButton></td>
</tr>
</table>
<tr>
<td>
<asp:Button runat="server" ID="btn_apply" CommandName="popup" OnClick="btn_apply_Click" Text="apply"/>
<script type="text/javascript">
function openModal() {
$('#exampleModal').modal('show');
}
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">
<ContentTemplate>
<asp:Button runat="server" ID="btn_save" OnClick="btn_save_Click" AutoPostBack="true" Text="Save" Height="34px"/>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn_save" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
Modal code
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered"> <div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Apply for Job</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Company Email : <asp:TextBox ID="txt_email" runat="server" ReadOnly="true" ></asp:TextBox><br /><br />
Job-Name : <asp:TextBox ID="txt_app_jname" runat="server" ReadOnly="true"></asp:TextBox>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button></div>
</div>
This is my code behind
protected void btn_apply_Click(object sender, EventArgs e)
{
RepeaterItem item = (sender as Button).Parent as RepeaterItem;
string cemail = (item.FindControl("link_cemail") as System.Web.UI.WebControls.LinkButton).Text;
txt_email.Text = cemail;
ClientScript.RegisterStartupScript(GetType(), "popup", "openModal()", true);
}
I have tried this and I am not getting any error but my modal is not opening up.
please can someone help me?
This is my advice:
I use for asp.net projects Ajaxtoolkit: http://www.ajaxtoolkit.net/
Then I add in my project the dll
In my aspx page, I added this line to work with ajax controls
For modal scream I did the next:
Used ajx:ModalPopupExtender
Put the modal in asp panel
Resume of my code:
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajx" %>
<ajx:ModalPopupExtender ID="mppPagos" runat="server" PopupControlID="pnl_PagosModal" TargetControlID="lk_BusquedaPagos" BackgroundCssClass="modalBackground">
</ajx:ModalPopupExtender>
<asp:HiddenField ID="lbl_IdAbono" Value="0" runat="server"/>
<div class="form-group row">
<div class="control-label col-lg-offset-0 col-md-2 col-lg-2">
<asp:LinkButton runat="server" CssClass="btn btn-success btn-sm" ID="lk_BusquedaPagos" Text=">> Agregar Pagos <<"></asp:LinkButton>
</div>
<div>
<asp:Button ID="btn_EliminarPagosRenta" CssClass="btn btn-success btn-sm" runat="server" Text="Eliminar Pago" OnClick="btn_EliminarPagosRenta_Click" />
</div>
</div>
<asp:Panel ID="pnl_PagosModal" runat="server" CssClass="panel EstiloPanel" ScrollBars="Vertical">
<asp:UpdatePanel ID="upl_ModalPagos" runat="server">
<ContentTemplate>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<div class="close">
<asp:Button ID="btnCerrarModalPago" runat="server" Text="x" CssClass="btn-xs" OnClick="btnCerrarModalPago_Click"/>
</div>
<h5 class="modal-title">Pagos</h5>
<asp:Label ID="lbl_ErrorPagos" runat="server" Text="" ForeColor="Red"></asp:Label>
</div>
<div class="modal-body">
<div class="tab-pane fade in active" id="tab3_1">
<asp:HiddenField ID="HiddenField2" runat="server"/>
<div class="form-group row">
<asp:Label ID="lbl_FormaPago" CssClass="control-label col-lg-offset-0 col-md-2 col-lg-2" runat="server" Text="Forma de Pago:"></asp:Label>
<div class="col-md-4 col-lg-3">
<telerik:RadComboBox ID="rad_ddl_FormaPago" runat="server" Height="100%" Width="100%" OnSelectedIndexChanged="rad_ddl_FormaPago_SelectedIndexChanged"
ZIndex="10000000" AutoPostBack="true"
EmptyMessage="Seleccionar Forma Pago" MarkFirstMatch="true" EnableLoadOnDemand="true">
</telerik:RadComboBox>
</div>
<asp:Label ID="lbl_NumeroTarjeta" CssClass="control-label col-lg-offset-0 col-md-2 col-lg-2" runat="server" Text="Número de Tarjeta:"></asp:Label>
<div class="col-md-4 col-lg-3">
<asp:TextBox ID="txtNumeroTarjeta" CssClass="form-control" runat="server"></asp:TextBox>
</div>
</div>
<div class="form-group row">
<asp:Label ID="lbl_MontoPago" CssClass="control-label col-lg-offset-0 col-md-2 col-lg-2" runat="server" Text="Monto Pago:"></asp:Label>
<div class="col-md-4 col-lg-3">
<asp:TextBox ID="txtMontoPago" CssClass="form-control" runat="server"></asp:TextBox>
</div>
<asp:Label ID="lbl_Cambio" CssClass="control-label col-lg-offset-0 col-md-2 col-lg-2" runat="server" Text="Cambio:"></asp:Label>
<div class="col-md-4 col-lg-3">
<asp:TextBox ID="txtMontoCambio" CssClass="form-control" runat="server"></asp:TextBox>
</div>
</div>
<div class="form-group row">
<asp:Label ID="lbl_DescGarantia" CssClass="control-label col-lg-offset-0 col-md-2 col-lg-2" runat="server" Text="Descripción de garantía:" Visible="false"></asp:Label>
<div class="col-md-4 col-lg-3">
<asp:TextBox ID="txt_DescGarantia" CssClass="form-control" runat="server" Visible="false"></asp:TextBox>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="btnAgregarPago" runat="server" Text="Agregar Pago" CssClass="btn btn-success btn-sm" OnClick="btnAgregarPago_Click" />
<asp:Button ID="btnAgregarMontoTarjeta" runat="server" Text="Agregar Monto Tarjeta" CssClass="btn btn-success btn-sm" OnClick="btnAgregarMontoTarjeta_Click" />
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>

Prevent refresh page on list view button click in asp .net

I'm working on product cart page. Below is the code I'm working with. In the list view I'm getting all the products images as buttons. I want to update the carousel when any of the image in the list view clicked.
But When I click the image the page refreshes, I tried using update panel but since the button are dynamic can't able to find a proper way to handle it.
<div class="col-md-8 single-top-in simpleCart_shelfItem">
<div style="align-content: center">
<strong>CLICK THE IMAGE TO SELECT </strong>
</div>
<asp:ListView ID="ImagesList" runat="server"
DataKeyNames="ID"
GroupItemCount="14"
OnPagePropertiesChanging="ImagesList_PagePropertiesChanging" class="data" OnSelectedIndexChanged="OnSelectedIndexChanged">
<EmptyDataTemplate>
No Images found.
</EmptyDataTemplate>
<LayoutTemplate>
<table>
<tr runat="server" id="groupPlaceholder" />
</table>
</LayoutTemplate>
<GroupTemplate>
<tr>
<td runat="server" id="itemPlaceholder" />
</tr>
</GroupTemplate>
<ItemTemplate>
<td>
<div class="data" data-image='<%#"assets/products/"+Eval("ImageUrl").ToString() %>'
data-name='<%# Eval("Description") %>' data-price='<%# Eval("Price") %>'
data-image1='<%#"assets/products/1_"+Eval("ImageUrl").ToString() %>'
data-image2='<%#"assets/products/2_"+Eval("ImageUrl").ToString() %>'>
<asp:LinkButton ID="GridBtn" runat="server" CssClass="myButton"
CommandName="Change"
OnCommand="btnDetails_Command"
CommandArgument='<%# Eval("Notes") %>'>
<img src='<%#"assets/products/"+Eval("ImageUrl").ToString() %>' class="image" style="width: 50px; height: 50px" alt="Change" /></asp:LinkButton>
</div>
</td>
</ItemTemplate>
</asp:ListView>
</div>
<div class="col-md-4 single_left pull-left left">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<fieldset>
<div class="flexslider">
<ul class="slides">
<li id="image3" data-thumb="">
<%--<img id="image3" src="assets/products/1_ZP244.jpg" />--%>
<img id="image" src="assets/products/1_ZP244.jpg" />
<%-- <asp:Image ID="image" src="assets/products/1_ZP244.jpg" runat="server" />--%>
</li>
<li id="image4" data-thumb="">
<%--<img id="image4" src="assets/products/1_ZP244.jpg" />--%>
<img id="image1" src="assets/products/1_ZP244.jpg" />
<%--<asp:Image ID="image1" src="assets/products/1_ZP244.jpg" runat="server" />--%>
</li>
<li id="image5" data-thumb="">
<%--<img id="image5" src="assets/products/1_ZP244.jpg" />--%>
<img id="image2" src="assets/products/1_ZP244.jpg" />
<%--<asp:Image ID="image2" src="assets/products/1_ZP244.jpg" runat="server" />--%>
</li>
</ul>
</div>
</fieldset>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSubmit" />
</Triggers>
</asp:UpdatePanel>
</div>
<script>
$(".data").mouseover(function () {
var image = $(this).attr('data-image');
var image1 = $(this).attr('data-image1');
var image2 = $(this).attr('data-image2');
var name = $(this).attr('data-name');
var price = $(this).attr('data-price');
var btnID = $(this).attr('ID');
$(".left").find('#image').attr('src', image);
$(".left").find('#image1').attr('src', image1);
$(".left").find('#image2').attr('src', image2);
$(".left").find('#image3').attr('data-thumb', image);
$(".left").find('#image4').attr('data-thumb', image1);
$(".left").find('#image5').attr('data-thumb', image2);
$(".left").find('#name').text(name);
$(".left").find('#price').text(price);
$(".left").find('#price').text(price);
})
</script>
You can register button for async postback inside an updatepanel by add a new OnPreRender event on the button:
protected void btnReloadQty_PreRender(object sender, EventArgs e)
{
ScriptManager scriptMan = ScriptManager.GetCurrent(this.Page);
scriptMan.RegisterAsyncPostBackControl((LinkButton)sender);
}

ModalPopupExtender hides when dropdown post back works

I have a model pop up extender, within this pop up i have a dropdown list with AutopostBack="True". Now when I select one dropdown value the ModalPopupExtender hides. Let me know the reason??? Someone preferred to put update panel but still the problem exists
My pop up controls is,
<cc1:ToolkitScriptManager runat="server" ID="ToolkitScriptManager1" EnableScriptGlobalization="true"></cc1:ToolkitScriptManager>
<asp:HiddenField ID="HiddenField1" runat="server" />
<cc1:ModalPopupExtender ID="ModalPopupExtender3" runat="server"
BehaviorID="modalPopupExtender3"
TargetControlID="HiddenField1"
OkControlID="cancel1"
BackgroundCssClass="modalPopup" >
</cc1:ModalPopupExtender>
<!-- Update section-->
<div id="updatdediv1" visible="false" >
<div class="portlet box blue" id="Div3">
<div class="portlet-title">
<div class="caption"><i class="icon-reorder"></i> Add Salary Component </div>
<div class="tools">
<asp:imagebutton ID="Imagebutton2" runat="server" class="close" ImageUrl="~/jimage/clossse.PNG" />
</div>
</div>
<div class="portlet-bodypop">
<div class="controls">
<label class="control-label">Pay Grade:</label>
<asp:DropDownList ID="ddpaygrade" runat="server" AutoPostBack="true" class="m-wrap large" AppendDataBoundItems="false" ></asp:DropDownList>
</div>
<div class="controls">
<label class="control-label">DA %:</label>
<asp:TextBox ID="txtda" runat="server" class="m-wrap large" ReadOnly="true"></asp:TextBox>
</div>
<div class="controls">
<label class="control-label">Basic:</label>
<asp:TextBox ID="txtbasic" runat="server" class="m-wrap large"></asp:TextBox>
</div>
<div class="controls">
<label class="control-label">Calculated DA:</label>
<asp:TextBox ID="txtcalculatedDA" class="m-wrap large" runat="server" ></asp:TextBox>
</div>
<div class="form-actions1">
<button id="Button2"onclick="myFunction()"" style="display:none" >Save</button>
<asp:Button ID="btnedit2" runat="server" Text="Submit" CssClass="btn blue" ValidationGroup="grp1" />
<asp:Button ID="btncancel3" runat="server" Text="Cancel" CssClass="btn"/>
<asp:Label ID="label1" runat="server" Text="" Visible="false"></asp:Label>
</div>
</div>
</div>
</div>
<!-- temp panel-->
<asp:Panel ID="kj" runat="server" >
<table >
<tr><td class="style9">
<table >
<tr> <td class="style8"> </td> </tr>
<tr >
<td align="left" class="style12">
<asp:Button ID="cancel1" runat="server" Text="Cancel" Style=" display:none"
</td>
</tr>
</table>
</td></tr></table>
</asp:Panel>
If you need the modal popup extender to "survive" the postback, then you will have to manage that yourself. Handle the dropdown's SelectedIndexChanged event and show the popup there:
protected void ddpaygrade_SelectedIndexChanged(object sender, EventArgs e)
{
ModalPopupExtender3.Show();
}
Don't forget to wire-up the event in your markup:
<asp:DropDownList ID="ddpaygrade" runat="server" AutoPostBack="true"
class="m-wrap large" AppendDataBoundItems="false"
OnSelectedIndexChanged="ddpaygrade_SelectedIndexChanged" >
</asp:DropDownList>

Alertify.JS and ASP.NET: Call Javascript from Code-behind

I have a question.
I am now using the current version of Alertify.js found here. I wanted to integrate it with my ASP.NET application. When I click the Save button from my Modal Dialog, it proceeds to the code-behind without problems. I've tried "alert("Test");" inside the ScriptManager.RegisterClientScriptBlock and it does render.
Now when I try to use my custom function located in one of the files I've added, it seems the script does not respond, i.e. Alertify does not show.
Here is the JavaScript code from my custom JS file, my C# Code behind for that Save button, and the ASP.NET Page.
JS
function callFeedbackMessage(inputType, inputText) {
var inputFeedback = inputType;
e.preventDefault();
if (inputType == 'Error') {
alertify.error(inputText);
return false;
}
else if (inputType == 'Success') {
alertify.success(inputText);
return false;
}
else {
alertify.log(inputText, "", 10000);
return false;
}
}
C# Code Behind of lnkSave_Click
protected void lnkSave_Click(object sender, EventArgs e)
{
Category newCategory = new ProgrammersToolkitLibrary.BOM.Category();
bool isSuccess = true;
newCategory.CategoryName = txtCategoryName.Text;
newCategory.Description = txtDescription.Text;
isSuccess = CategoryController.CreateNewCategory(newCategory);
if (isSuccess == true)
{
grdCategoriesList.DataBind();
upCategoriesList.Update();
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alert", "callFeedbackMessage('Success', 'Okay');", true);
}
else
{
}
}
ASP.NET Page
<%# Page Title="" Language="C#" MasterPageFile="~/Layout/Layout.Master" AutoEventWireup="true" CodeBehind="Category_List.aspx.cs" Inherits="ProgrammersToolkit.Views.Maintenance.Categories.Category_List" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div style ="text-align:left;">
<h3>Article Categories</h3>
<div class="btn-group">
<button class="btn btn-default" data-toggle="modal" data-target="#AddCategoryModal"><span class="glyphicon glyphicon-plus"></span> Add Category</button>
<asp:LinkButton ID="LinkButton2" runat="server" CssClass="btn btn-default"><img src="../../../Layout/img/Icon_Excel.gif" /> Export to Excel</asp:LinkButton>
<asp:LinkButton ID="LinkButton3" runat="server" CssClass="btn btn-default"><img src="../../../Layout/img/Icon_Excel.gif" /> Import from Excel</asp:LinkButton>
</div>
</div>
<br /><br />
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class ="col-lg-6">
<div class="input-group">
<asp:TextBox ID="txtSearch" runat="server" CssClass="form-control"></asp:TextBox>
<span class="input-group-btn">
<asp:LinkButton ID="lnkSearch" runat="server" CssClass="btn btn-default">Search</asp:LinkButton>
<asp:LinkButton ID="lnkReset" runat="server" CssClass="btn btn-default">Reset</asp:LinkButton>
</span>
</div>
</div>
<div class ="col-lg-6"></div>
</div>
</div>
<div class="panel-body">
<asp:UpdatePanel ID="upCategoriesList" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="grdCategoriesList" runat="server" CssClass = "table table-hover table-responsive" Width="100%"
DataSourceID="odsCategoriesList" AllowPaging="true" PageSize="10" GridLines="None" BorderStyle="NotSet" BorderWidth="0px"
AutoGenerateColumns="false">
<PagerSettings FirstPageText="<< First" LastPageText="Last >>" NextPageText="Next >"
Position="Bottom" PreviousPageText="< Previous" />
<Columns>
<asp:TemplateField HeaderStyle-CssClass="input-group-addon" ItemStyle-CssClass="input-group-addon">
<ItemTemplate>
<asp:CheckBox ID="chkSelectItem" runat="server" />
</ItemTemplate>
<HeaderTemplate>
<asp:CheckBox ID="chkSelectAll" runat="server" />
</HeaderTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText = "Category Name" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:LinkButton ID="lnkCategoryName" runat="server" OnCommand="lnkCategoryName_Command"
CommandArgument='<%# Eval("CategoryId") %>' CommandName='<%# Eval("CategoryName") %>'
Text='<%# Eval("CategoryName") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Description" HeaderText="Description" ItemStyle-HorizontalAlign="Left" />
</Columns>
<PagerStyle HorizontalAlign="Right" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:ObjectDataSource ID="odsCategoriesList" runat="server" EnablePaging="True" TypeName="ProgrammersToolkitLibrary.Controller.CategoryController"
SelectMethod="GetListOfCategories" SelectCountMethod="GetListOfCategoriesCount"></asp:ObjectDataSource>
</div>
<div class="modal fade" id="AddCategoryModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Add New Category</h4>
</div>
<div class="modal-body">
<table style="width:100%;text-align:left;">
<tr>
<td style = "width: 30%;"><label for="txtCategoryName">Category Name:</label></td>
<td>
<asp:TextBox ID="txtCategoryName" runat="server" CssClass="form-control"></asp:TextBox>
</td>
</tr>
<tr>
<td style = "width:30%; vertical-align:text-top;"><label for="txtDescription">Description:</label></td>
<td>
<asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Rows="3" CssClass="form-control"></asp:TextBox>
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<asp:LinkButton ID="lnkSave" runat="server" CssClass="btn btn-primary" OnClick="lnkSave_Click" ClientIDMode="Static">Save</asp:LinkButton>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</asp:Content>
Thank you.
Ju-chan

RadListView automatically sorting on ID column

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

Categories