|
Anybody familiar with Telerik's grid products...
We had code that previously implemented the telerik grid
@(Html.Telerik().Grid()<myTransactions>
.Name("Transactions")
.ClientEvents(events => events.OnLoad("TransactionsGrid_onLoad"))
.ClientEvents(events => events.OnDataBound("TransactionsGrid_onDataBound"))
.DataBinding(dataBinding => dataBinding
.Ajax()
.OperationMode(GridOperationMode.Client)
.Select("TransactionsAjax", controller))
We have recently migrated to Telerik's Kendo grid, and changed the code to the following:
@(Html.Kendo().Grid<myTransactions>()
.Name("Transactions")
.AutoBind(true)
.Events(events => events.DataBound("TransactionsGrid_onDataBound"))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Read(read => read.Action("TransactionsAjax", controller))
.PageSize(15))
In addition to the grid, the page has 3 other fields; a combobox and 2 date fields that filter the grid. The filtering works fine.
However, the printer friendly button calls TransactionsAjax for the Kendo grid and removes all filtering that was applied. The original Telerik just rendered the existing grid as print friendly without making a redundant call to TransactionsAjax.
Since the desired data to be printed is already filtered and available on the screen there is no reason to repeat the call. Is there some grid configuration setting I am missing that would stop the undesired call from happening?
|
|
|
|
|
Posting my findings in case somebody runs on to a similar issue, maybe it will be helpful (plus the code to set the select elements in the cloned div is cool ).
I've worked around the issue. Something about the first line of javascript in our printer friendly function causes the Ajax call to occur with the Kendo grid where it didn't cause it with the original Telerik grid. Changed javascript function to use jQuery clone and things are working now.
Old code:
function ShowPrinterFriendly() {
$("#printerFriendlyContent").html($("#mainContent").html());
New code:
function ShowPrinterFriendly() {
var $originalDiv = $("#mainContent");
var $clonedDiv = $originalDiv.clone();
var $originalSelects = $originalDiv.find("select");
$clonedDiv.find("select").each(function(index, item) {
$(item).val($originalSelects.eq(index).val());
});
$clonedDiv.appendTo("#printerFriendlyContent");
|
|
|
|
|
Suppose my stored procedure returns multiple datatable then how to manage that datatable in DataSet.xsd file
modified 6-Feb-14 3:30am.
|
|
|
|
|
Unfortunately If multiple result sets are retrieved through a single query, only the first result set is processed, and all other result sets are ignored.
Therefore, I suggest using one of two possibilities:
(1) Split the procedure into two separate procedures - one which returns data from EMP, and one from DEPT - and access the new procedures as two separate datasets.
(2) Union the two separate queries (with an additional column to indicate which query produced each row) and filter or conditionally format your report appropriately. The unioned query might look something like this:
SELECT EMPID ID, ENAME NAME, JOB JOB_LOC, SAL, DEPTID, 'EMP' SOURCE
FROM EMP
UNION ALL
SELECT DEPTID ID, DNAME NAME, LOC JOB_LOC, NULL SAL, DEPTID DEPTID, 'DEPT' SOURCE
FROM DEPT
|
|
|
|
|
Hello Everybody,
I would like to know if there is something I am missing why my ASP.NET is not running the script that is embedded in the master page, I imagine that it should be running in any page using the master page (where I have the event embedded) as shown in my screenshot but to my surprise it doesn't run the alert message ..
When I click any of the images I am not seeing the alert box that I am expecting as a response to the click event ..
My code is shown below .. any help much appreciated .. thanks again:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery-1.4.1.js" type="text/javascript" >
$('.main').ready(
function () {
alert('hello');
});
$('img').click(
function () {
alert('hello from image');
});
</script>
<script src="Scripts/myJavascriptTools.js" type="text/javascript" >
</script>
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
|
|
|
|
|
After http://www.w3schools.com/tags/tag_script.asp[^]
Quote: If the "src" attribute is present, the <script> element must be empty.
Put your script in separate element after jquery and it should run correctly.
<div class="signature">--
"My software never has bugs. It just develops random features."</div>
|
|
|
|
|
I am so excited it is starting to work .. I moved the script to a separate script tag as shown (just as you have advised) and it started showing up the "hello" message every time I open up a page attached to the master file .. yeeeey ...
$('.main').ready -------------- this event is working perfect
The way the code was written when the beautiful thing event I report happens is shown below:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery-1.4.1.js" type="text/javascript" >
</script>
<script type="text/javascript" >
$('.main').ready(
function () {
alert('hello');
});
$('img').click(
function () {
alert('hello from image');
});
</script>
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
The one I find odd however is that the click event is still not getting triggered
for some reason .. so what I did next was try to change it to a different tag targeting paragraph tag instead of img but retain it in the same spot i.e.
$('p').click(
The result is that it still is not triggered when I click from a paragraph the way it was not working when I was clicking from an image using the original code which used the img tag.
So I decided to try changing the event to a mouseover instead of a click as shown below:
$('p').mouseover(
Unfortunately the event is still not get triggered when I move my mouse over the paragraph elements ..
So at this point I am thinking it does not seem to have
anything to do with the tag selector or the event type ..
I decided to experiment and move the code as close to the
page being called (I'd wish of course that it could be
centralized in just one page i.e. Site.master) but just
for the sake of experiment I tried putting the code in the
page itself that is being called as shown below:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script type="text/javascript" >
$('p').click(
function () {
alert('hello from click of paragraph');
});
</script>
<h2>
Testing this page.
<asp:TreeView ID="TreeView1" runat="server">
</asp:TreeView>
</h2>
<p> testing paragraph1
</p>
<p>
testing paragraph2
</p>
<img src = "Image/coreTechnologies.png">
</asp:Content>
Unfortunately I still cannot get the click event to run
.. and right now I am scratching my head and trying to dig
in the books what I am still missing ... all help much appreciated ..thanks again and more power
|
|
|
|
|
You're executing the script before the browser has finished loading the body of the document, so there are no <img> or <p> tags for it to process.
The simplest solution is to make sure your script doesn't run before the body has been loaded:
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$('img').click(function(){
alert('hello from image');
});
});
</script>
It's also a good idea to move your scripts to the bottom of the page, just before the closing </body> tag.
If the content of the document might change after it's loaded, and you want the event handler to work on any new tags that get added, you can use jQuery's on method[^] to attach the handler at the document level:
$(document).on('click', 'img', function(){
alert('hello from image');
});
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Awesome ... thanks so much ... this has solved the problem I was having ...
It is my first time to ask a question here and not sure how to close a question
I do not know how to give this answer the five stars it deserves .. thumbs up in text
above indicates this to be the answer .. thanks again
|
|
|
|
|
I have 2 RadioButtonList
rdBtnPersonel_Status and rdBtnPersonel_FoodStatus
i wrote :
<asp:RadioButtonList runat="server" ID="rdBtnPersonel_Status" RepeatDirection="Horizontal" Width="100%"
DataSourceID="ObjDsPersonelStatuses" onclick="javascript:radioButtonListOnClick('<%#((RadiobuttonList)Container.FindControl("rdBtnPersonel_Status")).ClientID %>');">
</asp:RadioButtonList>
i want when i click rdBtnPersonel_Status , if the valu eual A the rdBtnPersonel_FoodStatus be disabled. (with javascript)
can any body help me?
|
|
|
|
|
I tried to change the flash banner text from 50% to 60% and its only show 60% in Desktops not in mobile.
Please let me know if any one have the solution detail and steps of how to fix it
modified 4-Feb-14 4:01am.
|
|
|
|
|
In if else structure when null arguments are passed to two string variables then it always hit the condition when i have set Var1 != "" && Var2 != "" why ? since nulls are passed to both then why it hits this condition ?
code:
public ActionResult ShowCalTextBox(String DateFrom, String DateTo)
{
if (DateFrom != "" && DateTo == "")
{
IEnumerable<GetEmpRec_DateResult> EmpRec_DateFrom = DataContext.GetEmpRec_Date(DateFrom, null).ToList();
ViewBag.Dates = "Records for"+" "+ DateFrom ;
return View(EmpRec_DateFrom);
}
else if (DateFrom == "" && DateTo != "")
{
IEnumerable<GetEmpRec_DateResult> EmpRec_DateTo = DataContext.GetEmpRec_Date(null, DateTo).ToList();
ViewBag.Dates = "Records for" + " " + DateTo;
return View(EmpRec_DateTo);
}
else if (DateFrom != "" && DateTo != "")
{
IEnumerable<GetEmpRec_DateResult> EmpRec_ByDate = DataContext.GetEmpRec_Date(DateFrom, DateTo).ToList();
ViewBag.Dates = "Records from" + " " + DateFrom +" "+"to"+" "+DateTo;
return View(EmpRec_ByDate);
}
else if (DateFrom == "" && DateTo == "")
{
IEnumerable<GetEmpRec_DateResult> EmpRec_Default = DataContext.GetEmpRec_Date(null, null).ToList();
ViewBag.Dates = "No date selection";
return View(EmpRec_Default);
}
return View();
}
it hits this one when i first browse this action or run this action.
else if (DateFrom == "" && DateTo != "")
|
|
|
|
|
null isn't "" (empty string)!!!
You should use String.IsNullOrEmpty(string_var) to check for both...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
How can I catch and retry if I got a duplicate keys error?
If InsertProviderMasterCommand failed due to dups go to GenerateKeys
and try again???
Try
GenerateKeys(myRow)
If InsertProviderMasterCommand(myRow) = True Then
MasterInsertCount += 1
End If
Catch ex As Exception
Throw ex
End Try
|
|
|
|
|
If you want to retry than why waste on try-catch block - do a simple while loop around the insert part...
bool bDo = true;
while(bDo)
{
GenerateKeys(myRow);
if(InsertProviderMasterCommand(myRow))
{
MasterInsertCount += 1;
bDo = false;
}
}
(I know you are a VB fan - but I can't bring myself to write that kind of code - sorry )
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Hi Friends,
I want to know some good books to refer for "ASP.Net best practices" ,I have googled the same and there are so many books available.So can any of you tell me some good book to refer depending upon your reading experiences.
Regards
|
|
|
|
|
|
Snehasish_Nandy wrote: It's my personal choice But it has nothing to do with ASP.NET.
Veni, vidi, abiit domum
|
|
|
|
|
Check this one[^] but the version is 3.5 & out of print. Book was from Apress.
Why only Books? Education Needed[^]
In Codeproject you could find more than bunch of articles on ASP.NET Best practices.
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
You have all the answers here:
ASP.Net Best Practices[^]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
I have this code is web.config
<anonymousIdentification enabled="true"/>
<profile enabled="true">
<properties>
<add name="FName" type="String" allowAnonymous="true"/>
</properties>
</profile>
<authentication mode="Windows" />
and this code is default.aspx.cs page
Profile.FName = TextBox1.Text;
Response.Write("Your name is: " + Profile.FName);
after runing the page, when I enter a data to text and click on button it gives me an error and this is error:
this.SetPropertyValue("FName", value);
and on the page error is:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
So, please help me to solve this problem.
|
|
|
|
|
Hi,
i didn't find any button on that,
i have run the code , i didn't find any error.
can you please produce the full and your requirement plz.
Thanks
|
|
|
|
|
You haven't configured the database connection correctly. The default settings will try to use a local instance of SQL Express to open a database called aspnetdb.mdf in your application's App_Data folder. If you don't have SQL Express installed, then the connection will not work.
To specify the database to connect to, you'll need to define a custom provider. You'll also need to run aspnet_regsql against the database to create the objects required to support the SqlProfileProvider .
Have a look at this article for more information: Implementing User Profiles in ASP.NET - A Beginner's Guide[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Kindly help me,
actually i am learning mvc
so which is best ,like i want to use entity framework with stored procedure ,kindly help
|
|
|
|
|