tag:blogger.com,1999:blog-81683729496632411322024-03-17T19:59:36.249-07:00Jayesh GoyaniJayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.comBlogger31125tag:blogger.com,1999:blog-8168372949663241132.post-14770710696823429062016-08-06T05:39:00.000-07:002016-09-02T12:15:30.710-07:00How to print multiple labels using BinaryPrinterCommands with neodynamic?<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">ClientPrintForMultipleFiles</span>(<span style="color: #333399; font-weight: bold;">string</span> printerName, <span style="color: #333399; font-weight: bold;">string</span> filesInfo, <span style="color: #333399; font-weight: bold;">bool</span> isLabel)
{
<span style="color: #888888;">//fileInfo is collection of FileName and FilePath details</span>
<span style="color: #008800; font-weight: bold;">if</span> (!String.IsNullOrEmpty(printerName))
{
<span style="color: #888888;">//Below code is required when you called this function from jquery ajax call</span>
<span style="color: #888888;">//filesInfo = filesInfo.Replace("FileName:", "FileName\":\"").Replace(",FilePath:", "\",\"FilePath\":\"").Replace("{", "{\"").Replace("}", "\"}");</span>
List<FileData> fileDetails = JsonConvert.DeserializeObject<List<FileData>>(filesInfo);
<span style="color: #008800; font-weight: bold;">if</span> (!isLabel)
{
ClientPrintJob cpj = <span style="color: #008800; font-weight: bold;">new</span> ClientPrintJob();
<span style="color: #008800; font-weight: bold;">foreach</span> (<span style="color: #333399; font-weight: bold;">var</span> obj <span style="color: #008800; font-weight: bold;">in</span> fileDetails)
{
cpj.PrintFileGroup.Add(<span style="color: #008800; font-weight: bold;">new</span> PrintFile(obj.FilePath, obj.FileName));
}
cpj.ClientPrinter = <span style="color: #008800; font-weight: bold;">new</span> InstalledPrinter(System.Web.HttpUtility.UrlDecode(printerName));
cpj.SendToClient(System.Web.HttpContext.Current.Response);
}
<span style="color: #008800; font-weight: bold;">else</span> <span style="color: #0066bb; font-weight: bold;">if</span> (isLabel)
{
ClientPrintJob cpj = <span style="color: #008800; font-weight: bold;">new</span> ClientPrintJob();
List<<span style="color: #333399; font-weight: bold;">byte</span>[]> buffer = <span style="color: #008800; font-weight: bold;">new</span> List<<span style="color: #333399; font-weight: bold;">byte</span>[]>();
<span style="color: #008800; font-weight: bold;">foreach</span> (<span style="color: #333399; font-weight: bold;">var</span> obj <span style="color: #008800; font-weight: bold;">in</span> fileDetails)
{
<span style="color: #333399; font-weight: bold;">string</span> filePath = System.IO.Path.Combine(obj.FilePath, obj.FileName);
buffer.Add(System.IO.File.ReadAllBytes(filePath));
}
cpj.BinaryPrinterCommands = JoinArrays(buffer);
cpj.ClientPrinter = <span style="color: #008800; font-weight: bold;">new</span> InstalledPrinter(System.Web.HttpUtility.UrlDecode(printerName));
cpj.SendToClient(System.Web.HttpContext.Current.Response);
}
}
}
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #333399; font-weight: bold;">byte</span>[] <span style="color: #0066bb; font-weight: bold;">JoinArrays</span>(IEnumerable<<span style="color: #333399; font-weight: bold;">byte</span>[]> arrays)
{
<span style="color: #333399; font-weight: bold;">int</span> offset = <span style="color: #6600ee; font-weight: bold;">0</span>;
<span style="color: #333399; font-weight: bold;">byte</span>[] fullArray = <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #333399; font-weight: bold;">byte</span>[arrays.Sum(a => a.Length)];
<span style="color: #008800; font-weight: bold;">foreach</span> (<span style="color: #333399; font-weight: bold;">byte</span>[] array <span style="color: #008800; font-weight: bold;">in</span> arrays)
{
Buffer.BlockCopy(array, <span style="color: #6600ee; font-weight: bold;">0</span>, fullArray, offset, array.Length);
offset += array.Length;
}
<span style="color: #008800; font-weight: bold;">return</span> fullArray;
}
......</pre>
<pre style="line-height: 125%; margin: 0;">......
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">FileData</span>
{
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">string</span> FileName { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">string</span> FilePath { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
}
</pre>
</div>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com1tag:blogger.com,1999:blog-8168372949663241132.post-6428430957114962282016-07-06T22:58:00.001-07:002016-09-19T08:36:02.033-07:00How to add and remove filter dynamically from kendo UI Grid<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>script<span style="color: #333333;">></span>
$(<span style="color: #007020;">document</span>).ready(<span style="color: #008800; font-weight: bold;">function</span> () {
<span style="color: #008800; font-weight: bold;">var</span> products <span style="color: #333333;">=</span> [{
ProductID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">1</span>,
ProductName<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Chai"</span>,
SupplierID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">1</span>,
CategoryID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">1</span>,
QuantityPerUnit<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"10 boxes x 20 bags"</span>,
UnitPrice<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">18.0000</span>,
UnitsInStock<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">39</span>,
UnitsOnOrder<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">0</span>,
ReorderLevel<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">10</span>,
Discontinued<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">false</span>,
Category<span style="color: #333333;">:</span> {
CategoryID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">1</span>,
CategoryName<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Beverages"</span>,
Description<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Soft drinks, coffees, teas, beers, and ales"</span>
}
}, {
ProductID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">2</span>,
ProductName<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Chang"</span>,
SupplierID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">1</span>,
CategoryID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">1</span>,
QuantityPerUnit<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"24 - 12 oz bottles"</span>,
UnitPrice<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">19.0000</span>,
UnitsInStock<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">17</span>,
UnitsOnOrder<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">40</span>,
ReorderLevel<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">25</span>,
Discontinued<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">false</span>,
Category<span style="color: #333333;">:</span> {
CategoryID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">1</span>,
CategoryName<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Beverages"</span>,
Description<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Soft drinks, coffees, teas, beers, and ales"</span>
}
}, {
ProductID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">3</span>,
ProductName<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Aniseed Syrup"</span>,
SupplierID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">1</span>,
CategoryID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">2</span>,
QuantityPerUnit<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"12 - 550 ml bottles"</span>,
UnitPrice<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">10.0000</span>,
UnitsInStock<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">13</span>,
UnitsOnOrder<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">70</span>,
ReorderLevel<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">25</span>,
Discontinued<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">false</span>,
Category<span style="color: #333333;">:</span> {
CategoryID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">2</span>,
CategoryName<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Condiments"</span>,
Description<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Sweet and savory sauces, relishes, spreads, and seasonings"</span>
}
}, {
ProductID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">4</span>,
ProductName<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Chef Anton's Cajun Seasoning"</span>,
SupplierID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">2</span>,
CategoryID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">2</span>,
QuantityPerUnit<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"48 - 6 oz jars"</span>,
UnitPrice<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">22.0000</span>,
UnitsInStock<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">53</span>,
UnitsOnOrder<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">0</span>,
ReorderLevel<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">0</span>,
Discontinued<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">false</span>,
Category<span style="color: #333333;">:</span> {
CategoryID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">2</span>,
CategoryName<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Condiments"</span>,
Description<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Sweet and savory sauces, relishes, spreads, and seasonings"</span>
}
}, {
ProductID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">5</span>,
ProductName<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Chef Anton's Gumbo Mix"</span>,
SupplierID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">2</span>,
CategoryID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">2</span>,
QuantityPerUnit<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"36 boxes"</span>,
UnitPrice<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">21.3500</span>,
UnitsInStock<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">0</span>,
UnitsOnOrder<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">0</span>,
ReorderLevel<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">0</span>,
Discontinued<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
Category<span style="color: #333333;">:</span> {
CategoryID<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">2</span>,
CategoryName<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Condiments"</span>,
Description<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Sweet and savory sauces, relishes, spreads, and seasonings"</span>
}
}];
$(<span style="background-color: #fff0f0;">"#grid"</span>).kendoGrid({
dataSource<span style="color: #333333;">:</span> {
data<span style="color: #333333;">:</span> products,
schema<span style="color: #333333;">:</span> {
model<span style="color: #333333;">:</span> {
id<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"ProductID"</span>,
fields<span style="color: #333333;">:</span> {
ProductID<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">'number'</span> },
UnitsInStock<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">'number'</span> },
ProductName<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">'string'</span> },
QuantityPerUnit<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">'string'</span> },
UnitPrice<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">'number'</span> },
}
}
},
},
filterable<span style="color: #333333;">:</span> {
mode<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"row"</span>
},
resizable<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
columns<span style="color: #333333;">:</span> [
{ field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"ProductName"</span> },
{ field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"UnitsInStock"</span>, title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"UnitsInStock"</span> },
{ field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"QuantityPerUnit"</span>, title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"QuantityPerUnit"</span> },
{ field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"UnitPrice"</span>, title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"UnitPrice"</span> },
]
});
});
<span style="color: #008800; font-weight: bold;">function</span> AddFilterinGrid() {
<span style="color: #008800; font-weight: bold;">var</span> grid <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"#grid"</span>).data(<span style="background-color: #fff0f0;">"kendoGrid"</span>);
addOrRemoveFilter(grid, <span style="background-color: #fff0f0;">"ProductName"</span>, <span style="background-color: #fff0f0;">"eq"</span>, <span style="background-color: #fff0f0;">"Chai"</span>);
}
<span style="color: #008800; font-weight: bold;">function</span> RemoveFilterinGrid() {
<span style="color: #008800; font-weight: bold;">var</span> grid <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"#grid"</span>).data(<span style="background-color: #fff0f0;">"kendoGrid"</span>);
addOrRemoveFilter(grid, <span style="background-color: #fff0f0;">"ProductName"</span>, <span style="background-color: #fff0f0;">"eq"</span>, <span style="background-color: #fff0f0;">""</span>);
}
<span style="color: #008800; font-weight: bold;">function</span> addOrRemoveFilter(grid, field, operator, value) {
<span style="color: #008800; font-weight: bold;">var</span> newFilter <span style="color: #333333;">=</span> { field<span style="color: #333333;">:</span> field, operator<span style="color: #333333;">:</span> operator, value<span style="color: #333333;">:</span> value };
<span style="color: #008800; font-weight: bold;">var</span> dataSource <span style="color: #333333;">=</span> grid.dataSource;
<span style="color: #008800; font-weight: bold;">var</span> filters <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #008800; font-weight: bold;">if</span> (dataSource.filter() <span style="color: #333333;">!=</span> <span style="color: #008800; font-weight: bold;">null</span>) {
filters <span style="color: #333333;">=</span> dataSource.filter().filters;
}
<span style="color: #008800; font-weight: bold;">if</span> (value <span style="color: #333333;">&&</span> value.length <span style="color: #333333;">></span> <span style="color: #0000dd; font-weight: bold;">0</span>) {
<span style="color: #888888;">//Add filter</span>
<span style="color: #008800; font-weight: bold;">if</span> (filters <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">null</span>) {
filters <span style="color: #333333;">=</span> [newFilter];
}
<span style="color: #008800; font-weight: bold;">else</span> {
<span style="color: #008800; font-weight: bold;">var</span> isNew <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">true</span>;
<span style="color: #008800; font-weight: bold;">var</span> index <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>;
<span style="color: #008800; font-weight: bold;">for</span> (index <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>; index <span style="color: #333333;"><</span> filters.length; index<span style="color: #333333;">++</span>) {
<span style="color: #008800; font-weight: bold;">if</span> (filters[index].field <span style="color: #333333;">==</span> field) {
isNew <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
<span style="color: #008800; font-weight: bold;">break</span>;
}
}
<span style="color: #008800; font-weight: bold;">if</span> (isNew) {
filters.push(newFilter);
}
<span style="color: #008800; font-weight: bold;">else</span> {
filters[index] <span style="color: #333333;">=</span> newFilter;
}
}
}
<span style="color: #008800; font-weight: bold;">else</span> {
<span style="color: #888888;">//Remove filter </span>
<span style="color: #008800; font-weight: bold;">var</span> removeIndex <span style="color: #333333;">=</span> <span style="color: #333333;">-</span><span style="color: #0000dd; font-weight: bold;">1</span>;
<span style="color: #008800; font-weight: bold;">for</span> (<span style="color: #008800; font-weight: bold;">var</span> x <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>; x <span style="color: #333333;"><</span> filters.length; x<span style="color: #333333;">++</span>) {
<span style="color: #008800; font-weight: bold;">var</span> temp <span style="color: #333333;">=</span> filters[x];
<span style="color: #008800; font-weight: bold;">if</span> (temp.field <span style="color: #333333;">==</span> field) {
removeIndex <span style="color: #333333;">=</span> x;
<span style="color: #008800; font-weight: bold;">break</span>;
}
}
<span style="color: #008800; font-weight: bold;">if</span> (removeIndex <span style="color: #333333;">!=</span> <span style="color: #333333;">-</span><span style="color: #0000dd; font-weight: bold;">1</span>)
filters.splice(removeIndex, <span style="color: #0000dd; font-weight: bold;">1</span>);
}
dataSource.filter(filters);
}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
</pre>
</div>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com5tag:blogger.com,1999:blog-8168372949663241132.post-66941154180638990562015-10-01T22:30:00.001-07:002016-09-02T12:23:45.360-07:00Get row and column index on change event or on click event on Kendo-UI Grid<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Get row and column index on click event</b><br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #008800; font-weight: bold;">function</span> onDataBound(e) {
<span style="color: #008800; font-weight: bold;">var</span> grid <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"#Grid"</span>).data(<span style="background-color: #fff0f0;">"kendoGrid"</span>);
$(grid.tbody).on(<span style="background-color: #fff0f0;">"click"</span>, <span style="background-color: #fff0f0;">"td"</span>, <span style="color: #008800; font-weight: bold;">function</span> (e) {
<span style="color: #008800; font-weight: bold;">var</span> row <span style="color: #333333;">=</span> $(<span style="color: #008800; font-weight: bold;">this</span>).closest(<span style="background-color: #fff0f0;">"tr"</span>);
<span style="color: #008800; font-weight: bold;">var</span> rowIdx <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"tr"</span>, grid.tbody).index(row);
<span style="color: #008800; font-weight: bold;">var</span> colIdx <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"td"</span>, row).index(<span style="color: #008800; font-weight: bold;">this</span>);
alert(rowIdx <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">'-'</span> <span style="color: #333333;">+</span> colIdx);
});
}
$(<span style="color: #007020;">document</span>).ready(<span style="color: #008800; font-weight: bold;">function</span> () {
$(<span style="background-color: #fff0f0;">"#Grid"</span>).kendoGrid({
dataSource<span style="color: #333333;">:</span> {
type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"odata"</span>,
transport<span style="color: #333333;">:</span> {
read<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"http://demos.kendoui.com/service/Northwind.svc/Orders"</span>,
dataType<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"jsonp"</span>
},
schema<span style="color: #333333;">:</span> {
model<span style="color: #333333;">:</span> {
fields<span style="color: #333333;">:</span> {
OrderID<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"number"</span> },
Freight<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"number"</span> },
ShipName<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"string"</span> },
OrderDate<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"date"</span> },
ShipCity<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"string"</span> }
}
}
},
pageSize<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">10</span>,
serverPaging<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
serverFiltering<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
serverSorting<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>
},
dataBound<span style="color: #333333;">:</span> onDataBound,
filterable<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
sortable<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
pageable<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
columns<span style="color: #333333;">:</span> [{
field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"OrderID"</span>,
filterable<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">false</span>
},
<span style="background-color: #fff0f0;">"Freight"</span>,
{
field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"OrderDate"</span>,
title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Order Date"</span>,
width<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">120</span>,
format<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"{0:MM/dd/yyyy}"</span>
}, {
field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"ShipName"</span>,
title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Ship Name"</span>,
width<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">260</span>
}, {
field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"ShipCity"</span>,
title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Ship City"</span>,
width<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">150</span>
}
]
});
});
<span style="color: #333333;"><</span>div id<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"Grid"</span><span style="color: #333333;">></span>
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/div></span>
</pre>
</div>
<b><br /></b>
<b>Get row and column index on Change event</b>
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>body<span style="color: #333333;">></span>
<span style="color: #333333;"><</span>script<span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">function</span> onChange(arg) {
<span style="color: #008800; font-weight: bold;">var</span> grid <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"#Grid"</span>).data(<span style="background-color: #fff0f0;">"kendoGrid"</span>);
<span style="color: #008800; font-weight: bold;">var</span> row <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">this</span>.select().closest(<span style="background-color: #fff0f0;">"tr"</span>);
<span style="color: #008800; font-weight: bold;">var</span> rowIdx <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"tr"</span>, grid.tbody).index(row);
<span style="color: #008800; font-weight: bold;">var</span> colIdx <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">this</span>.select().index();
alert(rowIdx <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">'-'</span> <span style="color: #333333;">+</span> colIdx);
}
$(<span style="color: #007020;">document</span>).ready(<span style="color: #008800; font-weight: bold;">function</span> () {
$(<span style="background-color: #fff0f0;">"#Grid"</span>).kendoGrid({
dataSource<span style="color: #333333;">:</span> {
type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"odata"</span>,
transport<span style="color: #333333;">:</span> {
read<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"http://demos.kendoui.com/service/Northwind.svc/Orders"</span>,
dataType<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"jsonp"</span>
},
schema<span style="color: #333333;">:</span> {
model<span style="color: #333333;">:</span> {
fields<span style="color: #333333;">:</span> {
OrderID<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"number"</span> },
Freight<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"number"</span> },
ShipName<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"string"</span> },
OrderDate<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"date"</span> },
ShipCity<span style="color: #333333;">:</span> { type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"string"</span> }
}
}
},
pageSize<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">10</span>,
serverPaging<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
serverFiltering<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
serverSorting<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>
},
selectable<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"multiple cell"</span>,
change<span style="color: #333333;">:</span> onChange,
filterable<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
sortable<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
pageable<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
columns<span style="color: #333333;">:</span> [{
field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"OrderID"</span>,
filterable<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">false</span>
},
<span style="background-color: #fff0f0;">"Freight"</span>,
{
field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"OrderDate"</span>,
title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Order Date"</span>,
width<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">120</span>,
format<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"{0:MM/dd/yyyy}"</span>
}, {
field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"ShipName"</span>,
title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Ship Name"</span>,
width<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">260</span>
}, {
field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"ShipCity"</span>,
title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Ship City"</span>,
width<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">150</span>
}
]
});
});
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
<span style="color: #333333;"><</span>div id<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"Grid"</span><span style="color: #333333;">></span>
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/div></span>
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/body></span>
</pre>
</div>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com3tag:blogger.com,1999:blog-8168372949663241132.post-69804482637976889272013-08-29T04:24:00.000-07:002016-09-02T12:39:50.139-07:00How to add serial number column in kendo ui grid<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Using MVC</b>
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">var</span> rowNumber <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>;
<span style="color: #008800; font-weight: bold;">function</span> resetRowNumber(e) {
rowNumber <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>;
}
<span style="color: #008800; font-weight: bold;">function</span> renderNumber(data) {
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #333333;">++</span>rowNumber;
}
<span style="color: #008800; font-weight: bold;">function</span> renderRecordNumber(data) {
<span style="color: #008800; font-weight: bold;">var</span> page <span style="color: #333333;">=</span> <span style="color: #007020;">parseInt</span>($(<span style="background-color: #fff0f0;">"#Grid"</span>).data(<span style="background-color: #fff0f0;">"kendoGrid"</span>).dataSource.page()) <span style="color: #333333;">-</span> <span style="color: #0000dd; font-weight: bold;">1</span>;
<span style="color: #008800; font-weight: bold;">var</span> pagesize <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"#Grid"</span>).data(<span style="background-color: #fff0f0;">"kendoGrid"</span>).dataSource.pageSize();
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #007020;">parseInt</span>(rowNumber <span style="color: #333333;">+</span> (<span style="color: #007020;">parseInt</span>(page) <span style="color: #333333;">*</span> <span style="color: #007020;">parseInt</span>(pagesize)));
}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
@(Html.Kendo().Grid<span style="color: #007700;"><MvcApplication1.Models.TestModels></span>()
.Name("Grid")
.Columns(columns => {
columns.Bound(p => p.ID);
columns.Bound(p => p.Name);
columns.Template(t => { }).Title("Row No").ClientTemplate( "#= renderNumber(data) #" );
columns.Template(t => { }).Title("Record No").ClientTemplate( "#= renderRecordNumber(data) #" );
})
.Pageable(x => x.PageSizes(new int[] { 10, 20, 30, 50 }).Refresh(true))
.Sortable()
.Filterable()
.DataSource(dataSource => dataSource.Ajax()
.Read(read => read.Action("Grid_Read", "Home"))
)
.Events(ev => ev.DataBound("resetRowNumber"))
)
</pre>
</div>
<b><br /></b>
<b>Using Javascript</b><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>div id<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"Grid"</span><span style="color: #333333;">></span>
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/div></span>
<span style="color: #333333;"><</span>script<span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">var</span> rowNumber <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>;
<span style="color: #008800; font-weight: bold;">function</span> resetRowNumber(e) {
rowNumber <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>;
}
<span style="color: #008800; font-weight: bold;">function</span> renderNumber(data) {
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #333333;">++</span>rowNumber;
}
<span style="color: #008800; font-weight: bold;">function</span> renderRecordNumber(data) {
<span style="color: #008800; font-weight: bold;">var</span> page <span style="color: #333333;">=</span> <span style="color: #007020;">parseInt</span>($(<span style="background-color: #fff0f0;">"#Grid"</span>).data(<span style="background-color: #fff0f0;">"kendoGrid"</span>).dataSource.page()) <span style="color: #333333;">-</span> <span style="color: #0000dd; font-weight: bold;">1</span>;
<span style="color: #008800; font-weight: bold;">var</span> pagesize <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"#Grid"</span>).data(<span style="background-color: #fff0f0;">"kendoGrid"</span>).dataSource.pageSize();
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #007020;">parseInt</span>(rowNumber <span style="color: #333333;">+</span> (<span style="color: #007020;">parseInt</span>(page) <span style="color: #333333;">*</span> <span style="color: #007020;">parseInt</span>(pagesize)));
}
$(<span style="color: #007020;">document</span>).ready(<span style="color: #008800; font-weight: bold;">function</span> () {
$(<span style="background-color: #fff0f0;">"#Grid"</span>).kendoGrid({
dataSource<span style="color: #333333;">:</span> {
type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"odata"</span>,
transport<span style="color: #333333;">:</span> {
read<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"http://demos.kendoui.com/service/Northwind.svc/Orders"</span>,
dataType<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"jsonp"</span>
},
pageSize<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">10</span>
},
pageable<span style="color: #333333;">:</span> {
refresh<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
pageSizes<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>
},
dataBound<span style="color: #333333;">:</span> resetRowNumber,
columns<span style="color: #333333;">:</span> [
{ field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"OrderID"</span>, title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Order ID"</span>, width<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">60</span> },
{ field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"CustomerID"</span>, title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Customer ID"</span>, width<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">90</span> },
{ title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Row No"</span>, width<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">90</span>, template<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"#= renderNumber(data) #"</span> },
{ title<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Record No"</span>, width<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">90</span>, template<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"#= renderRecordNumber(data) #"</span> }
]
});
});
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
</pre>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5Inob06yxKO8bOGimyPo-keUMnEsR88QnyDMBTotk44izLORUVes6u_RMEfw0Oh29EjVPsiIjlY4itgCaFKy9GwWjbs-dQRhB-rRRoRheR2C4y_7ShpL4qQyKpYTSaZANzUWUzNSlUmA/s1600/Untitled.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5Inob06yxKO8bOGimyPo-keUMnEsR88QnyDMBTotk44izLORUVes6u_RMEfw0Oh29EjVPsiIjlY4itgCaFKy9GwWjbs-dQRhB-rRRoRheR2C4y_7ShpL4qQyKpYTSaZANzUWUzNSlUmA/s640/Untitled.png" /></a></div>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com7tag:blogger.com,1999:blog-8168372949663241132.post-37758251804723209472013-08-14T05:39:00.001-07:002016-09-02T12:42:11.176-07:00.net interview question<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Question 1:</b>
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">Person</span>
{
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">string</span> Name { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">Program</span>
{
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #008800; font-weight: bold;">static</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">Main</span>(<span style="color: #333399; font-weight: bold;">string</span>[] args)
{
<span style="color: #333399; font-weight: bold;">var</span> person1 = <span style="color: #008800; font-weight: bold;">new</span> Person { Name = <span style="background-color: #fff0f0;">"Test"</span> };
Console.WriteLine(person1.Name);<span style="color: #888888;">//Output:Test</span>
Person person2 = person1;
person2.Name = <span style="background-color: #fff0f0;">"Shahrooz"</span>;
Console.WriteLine(person1.Name);<span style="color: #888888;">//Output:Shahrooz</span>
person2 = <span style="color: #008800; font-weight: bold;">null</span>;
Console.WriteLine(person1.Name);<span style="color: #888888;">//Output:???</span>
}
}
</pre>
</div>
For answer this please check below link.
<a href="http://stackoverflow.com/questions/18229463/reference-type-in-c-sharp">Click here to see Answer</a>
<br />
<br />
<br />
<b>Question 2:</b>
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">MyClass</span>
{
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">Func</span>(Object a)
{
Console.WriteLine(<span style="background-color: #fff0f0;">"Object"</span>);
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">Func</span>(String a)
{
Console.WriteLine(<span style="background-color: #fff0f0;">"String"</span>);
}
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">Program</span>
{
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #008800; font-weight: bold;">static</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">Main</span>(<span style="color: #333399; font-weight: bold;">string</span>[] args)
{
MyClass mc = <span style="color: #008800; font-weight: bold;">new</span> MyClass();
mc.Func(<span style="color: #008800; font-weight: bold;">null</span>);
}
}
</pre>
</div>
For answer this please check below link.
<br />
<a href="http://stackoverflow.com/questions/8229105/method-overloading-and-null-value">Click here to see Answer</a>
<br />
<a href="http://stackoverflow.com/questions/719546/c-passing-null-to-overloaded-method-which-method-is-called">Click here to see Answer</a>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com6tag:blogger.com,1999:blog-8168372949663241132.post-35581663509597582942013-06-18T03:29:00.000-07:002016-09-02T12:47:13.316-07:00Multi Selection Combobox in Kendo UI<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #007700;"><div></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"product"</span> <span style="color: #0000cc;">placeholder=</span><span style="background-color: #fff0f0;">"Select product..."</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><br</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"hf_product"</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"hidden"</span> <span style="color: #007700;">/></span>
Selected values : <span style="color: #007700;"><span</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"spanproduct"</span><span style="color: #007700;">></span></span>
<span style="color: #007700;"></div></span>
<span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
$(<span style="color: #007020;">document</span>).ready(<span style="color: #008800; font-weight: bold;">function</span> () {
$(<span style="background-color: #fff0f0;">"#fabric"</span>).kendoComboBox({
name<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"fabric"</span>,
dataTextField<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"DataText"</span>,
dataValueField<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"DataValue"</span>,
dataSource<span style="color: #333333;">:</span> [
{ DataText<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Select All"</span>, DataValue<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"0"</span> },
{ DataText<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Cotton"</span>, DataValue<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"1"</span> },
{ DataText<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Polyester"</span>, DataValue<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"2"</span> },
{ DataText<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Cotton/Polyester"</span>, DataValue<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"3"</span> },
{ DataText<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Rib Knit"</span>, DataValue<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"4"</span> }
],
filter<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"contains"</span>,
suggest<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
template<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"<input type='checkbox' id='chk_fabric_#=data.DataValue #' onclick='UpdateIdinHF(this);' value='#=data.DataValue #' name='fabric' />"</span> <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">" "</span> <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">"${ data.DataText }"</span>,
close<span style="color: #333333;">:</span> onClose,
change<span style="color: #333333;">:</span> onChange
});
});
<span style="color: #008800; font-weight: bold;">var</span> IsItemChecked <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
<span style="color: #008800; font-weight: bold;">function</span> UpdateIdinHF(obj) {
<span style="color: #008800; font-weight: bold;">var</span> id <span style="color: #333333;">=</span> $(obj).attr(<span style="background-color: #fff0f0;">'id'</span>);
<span style="color: #008800; font-weight: bold;">var</span> name <span style="color: #333333;">=</span> $(obj).attr(<span style="background-color: #fff0f0;">'name'</span>);
<span style="color: #008800; font-weight: bold;">var</span> value <span style="color: #333333;">=</span> <span style="color: #007020;">parseInt</span>($(obj).attr(<span style="background-color: #fff0f0;">'value'</span>));
<span style="color: #008800; font-weight: bold;">var</span> IsChecked <span style="color: #333333;">=</span> $(obj).is(<span style="background-color: #fff0f0;">':checked'</span>);
<span style="color: #008800; font-weight: bold;">var</span> hf <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"#hf_"</span> <span style="color: #333333;">+</span> name).get(<span style="color: #0000dd; font-weight: bold;">0</span>);
<span style="color: #008800; font-weight: bold;">if</span> (value <span style="color: #333333;">!=</span> <span style="color: #0000dd; font-weight: bold;">0</span>) {
UpdateIdInHiddenField(hf, value, IsChecked);
<span style="color: #008800; font-weight: bold;">var</span> totalchk <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">'input[id*="chk_'</span> <span style="color: #333333;">+</span> name <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">'"]'</span>).not(<span style="background-color: #fff0f0;">"#chk_"</span> <span style="color: #333333;">+</span> name <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">"_0"</span>).length;
<span style="color: #008800; font-weight: bold;">var</span> checkedchk <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">'input[id*="chk_'</span> <span style="color: #333333;">+</span> name <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">'"]:checked'</span>).not(<span style="background-color: #fff0f0;">"#chk_"</span> <span style="color: #333333;">+</span> name <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">"_0"</span>).length;
<span style="color: #008800; font-weight: bold;">if</span> (totalchk <span style="color: #333333;">==</span> checkedchk) {
$(<span style="background-color: #fff0f0;">"#chk_"</span> <span style="color: #333333;">+</span> name <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">"_0"</span>).prop(<span style="background-color: #fff0f0;">"checked"</span>, <span style="color: #008800; font-weight: bold;">true</span>);
}
<span style="color: #008800; font-weight: bold;">else</span> {
$(<span style="background-color: #fff0f0;">"#chk_"</span> <span style="color: #333333;">+</span> name <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">"_0"</span>).prop(<span style="background-color: #fff0f0;">"checked"</span>, <span style="color: #008800; font-weight: bold;">false</span>);
}
}
<span style="color: #008800; font-weight: bold;">else</span> {
$(<span style="background-color: #fff0f0;">'input[id*="chk_'</span> <span style="color: #333333;">+</span> name <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">'"]'</span>).each(<span style="color: #008800; font-weight: bold;">function</span> () {
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #007020;">parseInt</span>($(<span style="color: #008800; font-weight: bold;">this</span>).val()) <span style="color: #333333;">!=</span> <span style="color: #0000dd; font-weight: bold;">0</span>) {
<span style="color: #008800; font-weight: bold;">if</span> (IsChecked <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">true</span>) {
$(<span style="color: #008800; font-weight: bold;">this</span>).prop(<span style="background-color: #fff0f0;">"checked"</span>, <span style="color: #008800; font-weight: bold;">true</span>);
UpdateIdInHiddenField(hf, $(<span style="color: #008800; font-weight: bold;">this</span>).val(), IsChecked);
}
<span style="color: #008800; font-weight: bold;">else</span> {
$(<span style="color: #008800; font-weight: bold;">this</span>).prop(<span style="background-color: #fff0f0;">"checked"</span>, <span style="color: #008800; font-weight: bold;">false</span>);
UpdateIdInHiddenField(hf, $(<span style="color: #008800; font-weight: bold;">this</span>).val(), IsChecked);
}
}
});
}
IsItemChecked <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">true</span>;
}
<span style="color: #008800; font-weight: bold;">function</span> onClose(e) {
<span style="color: #008800; font-weight: bold;">if</span> (IsItemChecked <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">true</span>) {
IsItemChecked <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
e.preventDefault();
}
<span style="color: #008800; font-weight: bold;">else</span> {
ShowSelectedItem();
}
}
<span style="color: #008800; font-weight: bold;">function</span> ShowSelectedItem() {
$(<span style="background-color: #fff0f0;">"#spanfabric"</span>).html($(<span style="background-color: #fff0f0;">"#hf_fabric"</span>).val());
}
<span style="color: #008800; font-weight: bold;">function</span> UpdateIdInHiddenField(hf, id, IsAdd) {
<span style="color: #008800; font-weight: bold;">if</span> (hf.value <span style="color: #333333;">==</span> <span style="background-color: #fff0f0;">""</span>) {
hf.value <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">","</span>;
}
<span style="color: #008800; font-weight: bold;">if</span> (IsAdd <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">true</span>) {
<span style="color: #008800; font-weight: bold;">if</span> (hf.value.indexOf(<span style="background-color: #fff0f0;">","</span> <span style="color: #333333;">+</span> id <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">","</span>) <span style="color: #333333;">==</span> <span style="color: #333333;">-</span><span style="color: #0000dd; font-weight: bold;">1</span>) {
hf.value <span style="color: #333333;">=</span> hf.value <span style="color: #333333;">+</span> id <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">","</span>;
}
}
<span style="color: #008800; font-weight: bold;">else</span> <span style="color: #008800; font-weight: bold;">if</span> (IsAdd <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">false</span>) {
<span style="color: #008800; font-weight: bold;">if</span> (hf.value.indexOf(<span style="background-color: #fff0f0;">","</span> <span style="color: #333333;">+</span> id <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">","</span>) <span style="color: #333333;">>=</span> <span style="color: #0000dd; font-weight: bold;">0</span>) {
hf.value <span style="color: #333333;">=</span> hf.value.replace(<span style="background-color: #fff0f0;">","</span> <span style="color: #333333;">+</span> id <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">","</span>, <span style="background-color: #fff0f0;">","</span>);
}
}
}
<span style="color: #008800; font-weight: bold;">function</span> onChange(e) {
e.sender.value(<span style="color: #008800; font-weight: bold;">null</span>);
}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
</pre>
</div>
<br />
<b>If in your page combobox is used more then once then please check below code snippet:</b><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #007700;"><div></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"product"</span> <span style="color: #0000cc;">placeholder=</span><span style="background-color: #fff0f0;">"Select product..."</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><br</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"hf_product"</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"hidden"</span> <span style="color: #007700;">/></span>
Selected values : <span style="color: #007700;"><span</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"spanproduct"</span><span style="color: #007700;">></span></span>
<span style="color: #007700;"></div></span>
<span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
$(<span style="color: #007020;">document</span>).ready(<span style="color: #008800; font-weight: bold;">function</span> () {
$(<span style="background-color: #fff0f0;">"#product"</span>).kendoComboBox({
name<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"product"</span>,
dataTextField<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"DataText"</span>,
dataValueField<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"DataValue"</span>,
dataSource<span style="color: #333333;">:</span> [
{ DataText<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Select All"</span>, DataValue<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"0"</span> },
{ DataText<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Cotton"</span>, DataValue<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"1"</span> },
{ DataText<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Polyester"</span>, DataValue<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"2"</span> },
{ DataText<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Cotton/Polyester"</span>, DataValue<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"3"</span> },
{ DataText<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Rib Knit"</span>, DataValue<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"4"</span> }
],
filter<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"contains"</span>,
suggest<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
template<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"<input type='checkbox' id='chk_product_#=data.DataValue #' onclick='UpdateIdinHF(this);' value='#=data.DataValue #' name='product' />"</span> <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">" "</span> <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">"${ data.DataText }"</span>,
close<span style="color: #333333;">:</span> onClose,
change<span style="color: #333333;">:</span> onChange
});
});
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
</pre>
</div>
<a href="http://jsfiddle.net/Ln2wX/">LIVE DEMO</a>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com1tag:blogger.com,1999:blog-8168372949663241132.post-89095372830184021662013-05-24T02:16:00.001-07:002016-09-05T01:12:35.651-07:00How to add multiple series dynamically in kendo UI chart<div dir="ltr" style="text-align: left;" trbidi="on">
<b> <span style="font-size: 20px; text-decoration: underline;">Method1</span> </b>
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">var</span> dataSource;
<span style="color: #008800; font-weight: bold;">function</span> GetSelectedDuration() {
<span style="color: #008800; font-weight: bold;">return</span> $(<span style="background-color: #fff0f0;">"input:radio[name=Duration]:checked"</span>).val();
}
<span style="color: #008800; font-weight: bold;">function</span> ReBindDataSource() {
dataSource <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">new</span> kendo.data.DataSource({
transport<span style="color: #333333;">:</span> {
read<span style="color: #333333;">:</span> {
url<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"http://localhost/Home/GetDummydata"</span>,
cache<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">false</span>,
data<span style="color: #333333;">:</span> { Duration<span style="color: #333333;">:</span> GetSelectedDuration() }
}
}
});
dataSource.fetch(<span style="color: #008800; font-weight: bold;">function</span> () {
<span style="color: #008800; font-weight: bold;">if</span> (dataSource._data.length <span style="color: #333333;">></span> <span style="color: #0000dd; font-weight: bold;">0</span>) {
<span style="color: #008800; font-weight: bold;">var</span> keys <span style="color: #333333;">=</span> <span style="color: #007020;">Object</span>.keys(dataSource._data[<span style="color: #0000dd; font-weight: bold;">0</span>]);
ReDrawChart(keys);
}
});
}
<span style="color: #008800; font-weight: bold;">function</span> radioClicks() {
ReBindDataSource();
}
$(<span style="color: #007020;">document</span>).ready(<span style="color: #008800; font-weight: bold;">function</span> () {
$(<span style="background-color: #fff0f0;">"input:radio[name=Duration]"</span>).bind(<span style="background-color: #fff0f0;">"click"</span>, radioClicks);
$(<span style="background-color: #fff0f0;">"#mychart"</span>).kendoChart({
title<span style="color: #333333;">:</span> {
text<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Dynamic Column"</span>
},
legend<span style="color: #333333;">:</span> {
position<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"top"</span>
},
seriesDefaults<span style="color: #333333;">:</span> {
type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"column"</span>
},
valueAxis<span style="color: #333333;">:</span> {
labels<span style="color: #333333;">:</span> {
format<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"{0}%"</span>
},
line<span style="color: #333333;">:</span> {
visible<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>
}
},
categoryAxis<span style="color: #333333;">:</span> {
field<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Field1"</span>,
majorGridLines<span style="color: #333333;">:</span> {
visible<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">false</span>
}
},
tooltip<span style="color: #333333;">:</span> {
visible<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>,
format<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"{0}%"</span>,
template<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"#= series.field #: #= value #%"</span>
}
});
ReBindDataSource();
});
<span style="color: #888888;">// Add series dynamically in chart</span>
<span style="color: #008800; font-weight: bold;">function</span> ReDrawChart(keys) {
<span style="color: #008800; font-weight: bold;">var</span> InvalidColumnName <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #007020;">Array</span>(<span style="background-color: #fff0f0;">"_events"</span>, <span style="background-color: #fff0f0;">"uid"</span>, <span style="background-color: #fff0f0;">"parent"</span>, <span style="background-color: #fff0f0;">"Field1"</span>);
<span style="color: #008800; font-weight: bold;">var</span> chart <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"#mychart"</span>).data(<span style="background-color: #fff0f0;">"kendoChart"</span>);
<span style="color: #008800; font-weight: bold;">var</span> chartOptions <span style="color: #333333;">=</span> chart.options;
<span style="color: #008800; font-weight: bold;">var</span> SeriesCount <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>;
<span style="color: #008800; font-weight: bold;">for</span> (<span style="color: #008800; font-weight: bold;">var</span> k <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>; k <span style="color: #333333;"><</span> keys.length; k<span style="color: #333333;">++</span>) {
<span style="color: #008800; font-weight: bold;">var</span> mykey <span style="color: #333333;">=</span> keys[k];
<span style="color: #008800; font-weight: bold;">if</span> ($.inArray(mykey, InvalidColumnName) <span style="color: #333333;">==</span> <span style="color: #333333;">-</span><span style="color: #0000dd; font-weight: bold;">1</span>) {
chartOptions.series.push(<span style="color: #008800; font-weight: bold;">new</span> <span style="color: #007020;">Object</span>());
chartOptions.series[SeriesCount].field <span style="color: #333333;">=</span> mykey;
SeriesCount<span style="color: #333333;">++</span>;
}
}
chart.setDataSource(dataSource);
chart.redraw();
}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
<span style="color: #007700;"><div></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">checked=</span><span style="background-color: #fff0f0;">"checked"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Duration"</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"radio"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"1"</span> <span style="color: #007700;">/></span>Annully
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Duration"</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"radio"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"2"</span> <span style="color: #007700;">/></span>Monthly
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Duration"</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"radio"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"3"</span> <span style="color: #007700;">/></span>Weekly
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Duration"</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"radio"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"4"</span> <span style="color: #007700;">/></span>Daily
<span style="color: #007700;"></div></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"mychart"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></div></span>
</pre>
</div>
<b>
Below code snippet is only for reference to create Dummy data in MVC.
<b>Controller</b>
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">HomeController</span> : Controller
{
<span style="color: #0000CC"> [AllowAnonymous]</span>
<span style="color: #0000CC"> [HttpGet]</span>
<span style="color: #008800; font-weight: bold">public</span> JsonResult <span style="color: #0066BB; font-weight: bold">GetDummydata</span>(<span style="color: #333399; font-weight: bold">int</span> Duration)
{
List>TestModels> models = GetDummyData(Duration);
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #0066BB; font-weight: bold">Json</span>(models, JsonRequestBehavior.AllowGet);
}
<span style="color: #008800; font-weight: bold">public</span> List<TestModels> GetDummyData(<span style="color: #333399; font-weight: bold">int</span> Duration)
{
List<TestModels> models = <span style="color: #008800; font-weight: bold">new</span> List<TestModels>();
<span style="color: #008800; font-weight: bold">switch</span> (Duration)
{
<span style="color: #008800; font-weight: bold">case</span> (<span style="color: #333399; font-weight: bold">int</span>)DurationType.Annully:
TestModels testModel = <span style="color: #008800; font-weight: bold">new</span> TestModels();
testModel.Field1 = <span style="background-color: #fff0f0">"Annully"</span>;
testModel.Field2 = <span style="color: #6600EE; font-weight: bold">20</span>;
testModel.Field3 = <span style="color: #6600EE; font-weight: bold">50</span>;
testModel.Field4 = <span style="color: #6600EE; font-weight: bold">70</span>;
models.Add(testModel);
<span style="color: #008800; font-weight: bold">break</span>;
<span style="color: #008800; font-weight: bold">case</span> (<span style="color: #333399; font-weight: bold">int</span>)DurationType.Monthly:
TestModels testModel2 = <span style="color: #008800; font-weight: bold">new</span> TestModels();
testModel2.Field1 = <span style="background-color: #fff0f0">"Monthly"</span>;
testModel2.Field2 = <span style="color: #6600EE; font-weight: bold">50</span>;
testModel2.Field3 = <span style="color: #6600EE; font-weight: bold">50</span>;
testModel2.Field4 = <span style="color: #6600EE; font-weight: bold">50</span>;
models.Add(testModel2);
<span style="color: #008800; font-weight: bold">break</span>;
<span style="color: #008800; font-weight: bold">case</span> (<span style="color: #333399; font-weight: bold">int</span>)DurationType.Weekly:
TestModels testModel3 = <span style="color: #008800; font-weight: bold">new</span> TestModels();
testModel3.Field1 = <span style="background-color: #fff0f0">"Weekly"</span>;
testModel3.Field2 = <span style="color: #6600EE; font-weight: bold">70</span>;
testModel3.Field3 = <span style="color: #6600EE; font-weight: bold">10</span>;
testModel3.Field4 = <span style="color: #6600EE; font-weight: bold">90</span>;
models.Add(testModel3);
<span style="color: #008800; font-weight: bold">break</span>;
<span style="color: #008800; font-weight: bold">case</span> (<span style="color: #333399; font-weight: bold">int</span>)DurationType.Daily:
TestModels testModel4 = <span style="color: #008800; font-weight: bold">new</span> TestModels();
testModel4.Field1 = <span style="background-color: #fff0f0">"Daily"</span>;
testModel4.Field2 = <span style="color: #6600EE; font-weight: bold">11</span>;
testModel4.Field3 = <span style="color: #6600EE; font-weight: bold">111</span>;
testModel4.Field4 = <span style="color: #6600EE; font-weight: bold">1111</span>;
models.Add(testModel4);
<span style="color: #008800; font-weight: bold">break</span>;
}
<span style="color: #008800; font-weight: bold">return</span> models;
}
}
</pre></div>
<b>Model</b>
<!-- HTML generated using hilite.me --><div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #0000cc;">[Serializable]</span>
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">TestModels</span>
{
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">string</span> Field1 { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">int</span> Field2 { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">int</span> Field3 { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">int</span> Field4 { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
}
</pre>
</div>
<br />
<b><span style="font-size: 20px; text-decoration: underline;">Method2</span><b>
<br /><br /><br />
<!-- HTML generated using hilite.me --><div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">var</span> dataSource;
<span style="color: #008800; font-weight: bold;">function</span> radioClicks() {
getDataSource();
}
<span style="color: #008800; font-weight: bold;">function</span> GetSelectedDuration() {
<span style="color: #008800; font-weight: bold;">return</span> $(<span style="background-color: #fff0f0;">"input:radio[name=Duration]:checked"</span>).val();
}
<span style="color: #008800; font-weight: bold;">function</span> getDataSource() {
dataSource <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">new</span> kendo.data.DataSource({
transport<span style="color: #333333;">:</span> {
read<span style="color: #333333;">:</span> {
url<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"http://localhost:2116/Home/GetDummydata2"</span>,
cache<span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">false</span>,
data<span style="color: #333333;">:</span> { Duration<span style="color: #333333;">:</span> GetSelectedDuration() }
}
}
});
dataSource.fetch(<span style="color: #008800; font-weight: bold;">function</span> () {
GenerateChartFromData();
});
}
<span style="color: #008800; font-weight: bold;">function</span> GenerateChartFromData() {
<span style="color: #008800; font-weight: bold;">var</span> chartSeries <span style="color: #333333;">=</span> [];
<span style="color: #008800; font-weight: bold;">var</span> keys <span style="color: #333333;">=</span> <span style="color: #007020;">Object</span>.keys(dataSource._data[<span style="color: #0000dd; font-weight: bold;">0</span>]);
<span style="color: #008800; font-weight: bold;">var</span> InvalidColumnName <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #007020;">Array</span>(<span style="background-color: #fff0f0;">"_events"</span>, <span style="background-color: #fff0f0;">"uid"</span>, <span style="background-color: #fff0f0;">"parent"</span>, <span style="background-color: #fff0f0;">"Price"</span>);
<span style="color: #008800; font-weight: bold;">for</span> (<span style="color: #008800; font-weight: bold;">var</span> k <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>; k <span style="color: #333333;"><</span> keys.length; k<span style="color: #333333;">++</span>) {
<span style="color: #008800; font-weight: bold;">var</span> mykey <span style="color: #333333;">=</span> keys[k];
<span style="color: #008800; font-weight: bold;">if</span> ($.inArray(mykey, InvalidColumnName) <span style="color: #333333;">==</span> <span style="color: #333333;">-</span><span style="color: #0000dd; font-weight: bold;">1</span>) {
chartSeries.push({ xField<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"Price"</span>, yField<span style="color: #333333;">:</span> mykey, name<span style="color: #333333;">:</span> mykey.replace(<span style="background-color: #fff0f0;">"_"</span>, <span style="background-color: #fff0f0;">""</span>), style<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"smooth"</span> });
}
}
<span style="color: #008800; font-weight: bold;">var</span> titletxt <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"Title text comes here - "</span>;
<span style="color: #008800; font-weight: bold;">switch</span> (<span style="color: #007020;">parseInt</span>(GetSelectedDuration())) {
<span style="color: #008800; font-weight: bold;">case</span> <span style="color: #0000dd; font-weight: bold;">1</span><span style="color: #333333;">:</span>
titletxt <span style="color: #333333;">+=</span> <span style="background-color: #fff0f0;">"on "</span> <span style="color: #333333;">+</span> chartSeries[<span style="color: #0000dd; font-weight: bold;">0</span>].name;
<span style="color: #008800; font-weight: bold;">break</span>;
<span style="color: #008800; font-weight: bold;">case</span> <span style="color: #0000dd; font-weight: bold;">2</span><span style="color: #333333;">:</span>
titletxt <span style="color: #333333;">+=</span> <span style="background-color: #fff0f0;">"with multiple series"</span>;
<span style="color: #008800; font-weight: bold;">break</span>;
}
$(<span style="background-color: #fff0f0;">"#chart"</span>).kendoChart({
title<span style="color: #333333;">:</span> {
text<span style="color: #333333;">:</span> titletxt
},
legend<span style="color: #333333;">:</span> {
position<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"right"</span>
},
dataSource<span style="color: #333333;">:</span> dataSource,
seriesDefaults<span style="color: #333333;">:</span> {
type<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"scatterLine"</span>
},
series<span style="color: #333333;">:</span> chartSeries,
xAxis<span style="color: #333333;">:</span> {
min<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">19</span>,
max<span style="color: #333333;">:</span> <span style="color: #0000dd; font-weight: bold;">46</span>,
labels<span style="color: #333333;">:</span> {
format<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"{0}"</span>
}
},
yAxis<span style="color: #333333;">:</span> {
<span style="color: #888888;">// min: 80,</span>
labels<span style="color: #333333;">:</span> {
format<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"{0}"</span>
},
title<span style="color: #333333;">:</span> {
text<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"testTitle"</span>
}
}
});
}
$(<span style="color: #007020;">document</span>).ready(<span style="color: #008800; font-weight: bold;">function</span> () {
$(<span style="background-color: #fff0f0;">"input:radio[name=Duration]"</span>).bind(<span style="background-color: #fff0f0;">"click"</span>, radioClicks);
getDataSource();
});
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
<span style="color: #007700;"><div></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">checked=</span><span style="background-color: #fff0f0;">"checked"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Duration"</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"radio"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"1"</span> <span style="color: #007700;">/></span>Single series
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Duration"</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"radio"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"2"</span> <span style="color: #007700;">/></span>multiple series
<span style="color: #007700;"></div></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"chart"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></div></span>
</pre>
</div>
Below code snippet is only for reference to create Dummy data in MVC.
<b>Controller</b>
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">public</span> JsonResult <span style="color: #0066BB; font-weight: bold">GetDummydata2</span>(<span style="color: #333399; font-weight: bold">int</span> Duration)
{
<span style="color: #008800; font-weight: bold">switch</span> (Duration)
{
<span style="color: #008800; font-weight: bold">case</span> <span style="color: #6600EE; font-weight: bold">1</span>:
List<testmodels_1> lst = <span style="color: #008800; font-weight: bold">new</span> List<testmodels_1>();
<span style="color: #008800; font-weight: bold">for</span> (<span style="color: #333399; font-weight: bold">int</span> i = <span style="color: #6600EE; font-weight: bold">0</span>; i < <span style="color: #6600EE; font-weight: bold">20</span>; i++)
{
<span style="color: #333399; font-weight: bold">int</span> dtValue = <span style="color: #6600EE; font-weight: bold">0</span>;
<span style="color: #008800; font-weight: bold">if</span> (i < <span style="color: #6600EE; font-weight: bold">10</span>)
{
dtValue = -<span style="color: #6600EE; font-weight: bold">478</span>;
}
<span style="color: #008800; font-weight: bold">else</span> <span style="color: #0066BB; font-weight: bold">if</span> (i < <span style="color: #6600EE; font-weight: bold">12</span>)
{
dtValue = -<span style="color: #6600EE; font-weight: bold">78</span>;
}
<span style="color: #008800; font-weight: bold">else</span> <span style="color: #0066BB; font-weight: bold">if</span> (i < <span style="color: #6600EE; font-weight: bold">14</span>)
{
dtValue = -<span style="color: #6600EE; font-weight: bold">28</span>;
}
<span style="color: #008800; font-weight: bold">else</span> <span style="color: #0066BB; font-weight: bold">if</span> (i < <span style="color: #6600EE; font-weight: bold">16</span>)
{
dtValue = <span style="color: #6600EE; font-weight: bold">22</span>;
}
<span style="color: #008800; font-weight: bold">else</span> <span style="color: #0066BB; font-weight: bold">if</span> (i < <span style="color: #6600EE; font-weight: bold">18</span>)
{
dtValue = <span style="color: #6600EE; font-weight: bold">72</span>;
}
<span style="color: #008800; font-weight: bold">else</span>
{
dtValue = <span style="color: #6600EE; font-weight: bold">122</span>;
}
lst.Add(<span style="color: #008800; font-weight: bold">new</span> TestModels_1() { Price = <span style="color: #6600EE; font-weight: bold">20</span> + i, _07072014 = dtValue });
lst.Add(<span style="color: #008800; font-weight: bold">new</span> TestModels_1() { Price = <span style="color: #6600EE; font-weight: bold">20.5</span>M + i, _07072014 = dtValue });
}
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #0066BB; font-weight: bold">Json</span>(lst, JsonRequestBehavior.AllowGet);
<span style="color: #008800; font-weight: bold">break</span>;
<span style="color: #008800; font-weight: bold">case</span> <span style="color: #6600EE; font-weight: bold">2</span>:
List<testmodels_2> lst1 = <span style="color: #008800; font-weight: bold">new</span> List<testmodels_2>();
<span style="color: #008800; font-weight: bold">for</span> (<span style="color: #333399; font-weight: bold">int</span> j = <span style="color: #6600EE; font-weight: bold">0</span>; j < <span style="color: #6600EE; font-weight: bold">20</span>; j++)
{
<span style="color: #333399; font-weight: bold">int</span> dtValue1 = <span style="color: #6600EE; font-weight: bold">0</span>;
<span style="color: #008800; font-weight: bold">if</span> (j < <span style="color: #6600EE; font-weight: bold">10</span>)
{
dtValue1 = -<span style="color: #6600EE; font-weight: bold">478</span>;
}
<span style="color: #008800; font-weight: bold">else</span> <span style="color: #0066BB; font-weight: bold">if</span> (j < <span style="color: #6600EE; font-weight: bold">12</span>)
{
dtValue1 = -<span style="color: #6600EE; font-weight: bold">78</span>;
}
<span style="color: #008800; font-weight: bold">else</span> <span style="color: #0066BB; font-weight: bold">if</span> (j < <span style="color: #6600EE; font-weight: bold">14</span>)
{
dtValue1 = -<span style="color: #6600EE; font-weight: bold">28</span>;
}
<span style="color: #008800; font-weight: bold">else</span> <span style="color: #0066BB; font-weight: bold">if</span> (j < <span style="color: #6600EE; font-weight: bold">16</span>)
{
dtValue1 = <span style="color: #6600EE; font-weight: bold">22</span>;
}
<span style="color: #008800; font-weight: bold">else</span> <span style="color: #0066BB; font-weight: bold">if</span> (j < <span style="color: #6600EE; font-weight: bold">18</span>)
{
dtValue1 = <span style="color: #6600EE; font-weight: bold">72</span>;
}
<span style="color: #008800; font-weight: bold">else</span>
{
dtValue1 = <span style="color: #6600EE; font-weight: bold">122</span>;
}
lst1.Add(<span style="color: #008800; font-weight: bold">new</span> TestModels_2() { Price = <span style="color: #6600EE; font-weight: bold">20</span> + j, _07072014 = dtValue1, _08072014 = dtValue1 - <span style="color: #6600EE; font-weight: bold">20</span>, _08082014 = dtValue1 - <span style="color: #6600EE; font-weight: bold">30</span> });
lst1.Add(<span style="color: #008800; font-weight: bold">new</span> TestModels_2() { Price = <span style="color: #6600EE; font-weight: bold">20.5</span>M + j, _07072014 = dtValue1, _08072014 = dtValue1 - <span style="color: #6600EE; font-weight: bold">70</span>, _08082014 = dtValue1 - <span style="color: #6600EE; font-weight: bold">80</span> });
}
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #0066BB; font-weight: bold">Json</span>(lst1, JsonRequestBehavior.AllowGet);
<span style="color: #008800; font-weight: bold">break</span>;
}
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #0066BB; font-weight: bold">Json</span>(<span style="color: #008800; font-weight: bold">new</span> { IsError = <span style="color: #008800; font-weight: bold">true</span> }, JsonRequestBehavior.AllowGet);
}
<span style="color: #008800; font-weight: bold">public</span> DateTime? GetDateTimeFromString(<span style="color: #333399; font-weight: bold">string</span> strDateTime)
{
<span style="color: #008800; font-weight: bold">if</span> (!<span style="color: #333399; font-weight: bold">string</span>.IsNullOrEmpty(strDateTime.Trim()))
{
<span style="color: #333399; font-weight: bold">string</span> pattern = <span style="background-color: #fff0f0">"dd/MM/yyy"</span>;
DateTime parsedDate;
<span style="color: #008800; font-weight: bold">if</span> (DateTime.TryParseExact(strDateTime.Trim(), pattern, <span style="color: #008800; font-weight: bold">null</span>, System.Globalization.DateTimeStyles.None, <span style="color: #008800; font-weight: bold">out</span> parsedDate))
{
<span style="color: #008800; font-weight: bold">return</span> parsedDate;
}
}
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #008800; font-weight: bold">null</span>;
}
</pre></div>
<b>Model</b>
<!-- HTML generated using hilite.me --><div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #0000cc;">[Serializable]</span>
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">TestModels_1</span>
{
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">decimal</span> Price { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">decimal</span> _07072014 { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">TestModels_2</span>
{
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">decimal</span> Price { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">decimal</span> _07072014 { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">decimal</span> _08072014 { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">decimal</span> _08082014 { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
}
</pre>
</div>
<br />
<a href="https://onedrive.live.com/redir?resid=977B16A5E89A5236%21217">DOWNLOAD DEMO</a>
</b></b>
</b></div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com16tag:blogger.com,1999:blog-8168372949663241132.post-63788144325326962502013-05-04T07:07:00.000-07:002016-09-05T00:36:09.104-07:00How to add a new worksheet after all of the others in Excel Interop<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;">Worksheet xlNewSheet = null;
// Add new worksheet in workbook
xlNewSheet = (Excel.Worksheet)xlWorkbook.Worksheets.Add(missing, missing, missing, missing);
// Add new worksheet at the end of all sheets in workbook
xlNewSheet = (Excel.Worksheet)xlWorkbook.Sheets.Add(After: xlWorkbook.Sheets[xlWorkbook.Sheets.Count], Count: 1, Type: Excel.XlSheetType.xlWorksheet);
// Give worksheet name
xlNewSheet.Name = worksheetName;
</pre>
</div>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com2tag:blogger.com,1999:blog-8168372949663241132.post-73469110304084023712013-01-31T00:16:00.000-08:002016-09-05T00:38:40.934-07:00Download Files From Grid in Kendo UI<b>View</b>
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%">@(Html.Kendo().Grid<span style="color: #007700"><MvcApplication1.Models.TestModels></span>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.ID).Groupable(false);
columns.Bound(p => p.Name);
columns.Template(@).ClientTemplate("Download file").Title("Download1");
columns.Template(@).ClientTemplate("" + Html.ActionLink("Download me", "DocumentDownload2", "Home", new { id = "#=ID#" }, null) + "").Title("Download2");
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Grid_Read", "Home"))
)
)
</pre></div>
<b>Controller</b>
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">public</span> ActionResult <span style="color: #0066BB; font-weight: bold">Grid_Read</span>([DataSourceRequest] DataSourceRequest request)
{
List<TestModels> models = <span style="color: #008800; font-weight: bold">new</span> List<TestModels>();
<span style="color: #008800; font-weight: bold">for</span> (<span style="color: #333399; font-weight: bold">int</span> i = <span style="color: #6600EE; font-weight: bold">1</span>; i < <span style="color: #6600EE; font-weight: bold">6</span>; i++)
{
TestModels model = <span style="color: #008800; font-weight: bold">new</span> TestModels();
model.ID = i;
model.Name = <span style="background-color: #fff0f0">"Name"</span> + i;
models.Add(model);
}
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #0066BB; font-weight: bold">Json</span>(models.ToDataSourceResult(request));
}
<span style="color: #008800; font-weight: bold">public</span> ActionResult <span style="color: #0066BB; font-weight: bold">DocumentDownload1</span>()
{
<span style="color: #333399; font-weight: bold">string</span> contentType = <span style="background-color: #fff0f0">"application/xlsx"</span>;
<span style="color: #333399; font-weight: bold">string</span> filePath = Server.MapPath(<span style="background-color: #fff0f0">"~/Files/YourFileName.xlsx"</span>);
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #0066BB; font-weight: bold">File</span>(filePath, contentType, <span style="background-color: #fff0f0">"YourFileName.xlsx"</span>);
}
<span style="color: #008800; font-weight: bold">public</span> ActionResult <span style="color: #0066BB; font-weight: bold">DocumentDownload2</span>(<span style="color: #333399; font-weight: bold">int</span> id)
{
<span style="color: #333399; font-weight: bold">string</span> contentType = <span style="background-color: #fff0f0">"application/xlsx"</span>;
<span style="color: #333399; font-weight: bold">string</span> filePath = Server.MapPath(<span style="background-color: #fff0f0">"~/Files/YourFileName.xlsx"</span>);
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #0066BB; font-weight: bold">File</span>(filePath, contentType, <span style="background-color: #fff0f0">"YourFileName_"</span> + id.ToString() + <span style="background-color: #fff0f0">".xlsx"</span>);
}
</pre></div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com3tag:blogger.com,1999:blog-8168372949663241132.post-40818525720452015662013-01-21T03:06:00.003-08:002016-09-05T00:42:53.852-07:00How to use special characters in enums in asp.net<div dir="ltr" style="text-align: left;" trbidi="on">
<b>aspx</b>
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #007700;"><telerik:radgrid</span> <span style="color: #0000cc;">autogeneratecolumns=</span><span style="background-color: #fff0f0;">"False"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"RadGrid1"</span> <span style="color: #0000cc;">onitemdatabound=</span><span style="background-color: #fff0f0;">"RadGrid1_ItemDataBound"</span> <span style="color: #0000cc;">onneeddatasource=</span><span style="background-color: #fff0f0;">"RadGrid1_NeedDataSource"</span> <span style="color: #0000cc;">runat=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><mastertableview</span> <span style="color: #0000cc;">datakeynames=</span><span style="background-color: #fff0f0;">"Rating"</span> <span style="color: #0000cc;">editmode=</span><span style="background-color: #fff0f0;">"InPlace"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><columns></span>
<span style="color: #007700;"><telerik:gridboundcolumn</span> <span style="color: #0000cc;">datafield=</span><span style="background-color: #fff0f0;">"Shipper"</span> <span style="color: #0000cc;">headertext=</span><span style="background-color: #fff0f0;">"Shipper"</span> <span style="color: #0000cc;">uniquename=</span><span style="background-color: #fff0f0;">"Shipper"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></telerik:gridboundcolumn></span>
<span style="color: #007700;"><telerik:gridboundcolumn</span> <span style="color: #0000cc;">datafield=</span><span style="background-color: #fff0f0;">"ShipperName"</span> <span style="color: #0000cc;">headertext=</span><span style="background-color: #fff0f0;">"ShipperName"</span> <span style="color: #0000cc;">uniquename=</span><span style="background-color: #fff0f0;">"ShipperName"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></telerik:gridboundcolumn></span>
<span style="color: #007700;"><telerik:gridtemplatecolumn</span> <span style="color: #0000cc;">uniquename=</span><span style="background-color: #fff0f0;">"Rating"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><itemtemplate></span>
<span style="color: #007700;"><asp:label</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Label1"</span> <span style="color: #0000cc;">runat=</span><span style="background-color: #fff0f0;">"server"</span> <span style="color: #0000cc;">text=</span><span style="background-color: #fff0f0;">"</span><span style="color: #007700;"><%#</span> Eval(&quot;Rating&quot;) <span style="color: #007700;">%></span>"><span style="color: #007700;"></asp:label></span>
<span style="color: #007700;"></itemtemplate></span>
<span style="color: #007700;"><edititemtemplate></span>
<span style="color: #007700;"><telerik:radcombobox</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"RadComboBox1"</span> <span style="color: #0000cc;">runat=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></telerik:radcombobox></span>
<span style="color: #007700;"></edititemtemplate></span>
<span style="color: #007700;"></telerik:gridtemplatecolumn></span>
<span style="color: #007700;"><telerik:grideditcommandcolumn></span>
<span style="color: #007700;"></telerik:grideditcommandcolumn></span>
<span style="color: #007700;"></columns></span>
<span style="color: #007700;"></mastertableview></span>
<span style="color: #007700;"></telerik:radgrid></span>
</pre>
</div>
<b>aspx.cs</b>
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #008800; font-weight: bold;">protected</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">Page_Load</span>(<span style="color: #333399; font-weight: bold;">object</span> sender, EventArgs e)
{
Class1.BindDropDownListWithEnum(<span style="color: #008800; font-weight: bold;">ref</span> DropDownList1, <span style="color: #008800; font-weight: bold;">typeof</span>(Enums.ShipperRating));
}
<span style="color: #008800; font-weight: bold;">protected</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">RadGrid1_NeedDataSource</span>(<span style="color: #333399; font-weight: bold;">object</span> sender, GridNeedDataSourceEventArgs e)
{
DataTable dt = <span style="color: #008800; font-weight: bold;">new</span> DataTable();
dt.Columns.Add(<span style="background-color: #fff0f0;">"Shipper"</span>, <span style="color: #008800; font-weight: bold;">typeof</span>(<span style="color: #333399; font-weight: bold;">int</span>));
dt.Columns.Add(<span style="background-color: #fff0f0;">"ShipperName"</span>, <span style="color: #008800; font-weight: bold;">typeof</span>(<span style="color: #333399; font-weight: bold;">string</span>));
dt.Columns.Add(<span style="background-color: #fff0f0;">"Rating"</span>, <span style="color: #008800; font-weight: bold;">typeof</span>(<span style="color: #333399; font-weight: bold;">int</span>));
dt.Rows.Add(<span style="background-color: #fff0f0;">"1"</span>, <span style="background-color: #fff0f0;">"ShipperName1"</span>, <span style="background-color: #fff0f0;">"1"</span>);
dt.Rows.Add(<span style="background-color: #fff0f0;">"2"</span>, <span style="background-color: #fff0f0;">"ShipperName2"</span>, <span style="background-color: #fff0f0;">"2"</span>);
dt.Rows.Add(<span style="background-color: #fff0f0;">"3"</span>, <span style="background-color: #fff0f0;">"ShipperName3"</span>, <span style="background-color: #fff0f0;">"2"</span>);
RadGrid1.DataSource = dt;
}
<span style="color: #008800; font-weight: bold;">protected</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">RadGrid1_ItemDataBound</span>(<span style="color: #333399; font-weight: bold;">object</span> sender, GridItemEventArgs e)
{
<span style="color: #008800; font-weight: bold;">if</span> (e.Item.IsInEditMode && e.Item <span style="color: #008800; font-weight: bold;">is</span> GridEditableItem)
{
GridEditableItem item = e.Item <span style="color: #008800; font-weight: bold;">as</span> GridEditableItem;
RadComboBox RadComboBox1 = item.FindControl(<span style="background-color: #fff0f0;">"RadComboBox1"</span>) <span style="color: #008800; font-weight: bold;">as</span> RadComboBox;
<span style="color: #333399; font-weight: bold;">int</span> Rating = Convert.ToInt32(item.GetDataKeyValue(<span style="background-color: #fff0f0;">"Rating"</span>));
Class1.BindRadComboBoxWithEnum(<span style="color: #008800; font-weight: bold;">ref</span> RadComboBox1, <span style="color: #008800; font-weight: bold;">typeof</span>(Enums.ShipperRating));
<span style="color: #008800; font-weight: bold;">if</span> (RadComboBox1.Items.FindItemByValue(Convert.ToString(Rating)) != <span style="color: #008800; font-weight: bold;">null</span>)
{
RadComboBox1.Items.FindItemByValue(Convert.ToString(Rating)).Selected = <span style="color: #008800; font-weight: bold;">true</span>;
}
}
}
Class1.cs
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">DisplayValue</span> : Attribute
{
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #333399; font-weight: bold;">string</span> _value;
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #0066bb; font-weight: bold;">DisplayValue</span>(<span style="color: #333399; font-weight: bold;">string</span> <span style="color: #008800; font-weight: bold;">value</span>)
{
_value = <span style="color: #008800; font-weight: bold;">value</span>;
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">string</span> Value
{
<span style="color: #008800; font-weight: bold;">get</span> { <span style="color: #008800; font-weight: bold;">return</span> _value; }
}
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">EnumListItem</span>
{
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #333399; font-weight: bold;">int</span> _value;
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">int</span> Value
{
<span style="color: #008800; font-weight: bold;">get</span> { <span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">this</span>._value; }
<span style="color: #008800; font-weight: bold;">set</span> { <span style="color: #008800; font-weight: bold;">this</span>._value = <span style="color: #008800; font-weight: bold;">value</span>; }
}
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #333399; font-weight: bold;">string</span> _displayName;
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">string</span> DisplayName
{
<span style="color: #008800; font-weight: bold;">get</span> { <span style="color: #008800; font-weight: bold;">return</span> _displayName; }
<span style="color: #008800; font-weight: bold;">set</span> { _displayName = <span style="color: #008800; font-weight: bold;">value</span>; }
}
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #333399; font-weight: bold;">string</span> _name;
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">string</span> Name
{
<span style="color: #008800; font-weight: bold;">get</span> { <span style="color: #008800; font-weight: bold;">return</span> _name.Replace(<span style="background-color: #fff0f0;">"_"</span>, <span style="background-color: #fff0f0;">" "</span>); }
<span style="color: #008800; font-weight: bold;">set</span> { _name = <span style="color: #008800; font-weight: bold;">value</span>.Replace(<span style="background-color: #fff0f0;">"_"</span>, <span style="background-color: #fff0f0;">" "</span>); }
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #0066bb; font-weight: bold;">EnumListItem</span>(<span style="color: #333399; font-weight: bold;">int</span> Value, <span style="color: #333399; font-weight: bold;">string</span> Name, <span style="color: #333399; font-weight: bold;">string</span> DisplayName)
{
_value = Value;
_displayName = <span style="color: #333399; font-weight: bold;">string</span>.IsNullOrEmpty(DisplayName) ? Name : DisplayName;
_name = Name;
}
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">Enums</span>
{
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">enum</span> ShipperRating
{
<span style="color: #0000cc;"> [DisplayValue("1-3 (Poor)")]</span>
Poor = <span style="color: #6600ee; font-weight: bold;">1</span>,
<span style="color: #0000cc;"> [DisplayValue("4-5 (Fair/Average)")]</span>
Average = <span style="color: #6600ee; font-weight: bold;">2</span>,
<span style="color: #0000cc;"> [DisplayValue("6-7 (Good)")]</span>
Good = <span style="color: #6600ee; font-weight: bold;">3</span>
}
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">static</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">Class1</span>
{
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">static</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">BindDropDownListWithEnum</span>(<span style="color: #008800; font-weight: bold;">ref</span> DropDownList ddl, Type enumType)
{
List<enumlistitem> el = GetEnumValues(enumType, <span style="color: #008800; font-weight: bold;">false</span>);
ddl.DataSource = el;
ddl.DataTextField = <span style="background-color: #fff0f0;">"DisplayName"</span>;
ddl.DataValueField = <span style="background-color: #fff0f0;">"Value"</span>;
ddl.DataBind();
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">static</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">BindRadComboBoxWithEnum</span>(<span style="color: #008800; font-weight: bold;">ref</span> RadComboBox radcmb, Type enumType)
{
List<enumlistitem> el = GetEnumValues(enumType, <span style="color: #008800; font-weight: bold;">true</span>);
radcmb.DataSource = el;
radcmb.DataTextField = <span style="background-color: #fff0f0;">"DisplayName"</span>;
radcmb.DataValueField = <span style="background-color: #fff0f0;">"Value"</span>;
radcmb.DataBind();
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">static</span> List<enumlistitem> GetEnumValues(Type type, <span style="color: #333399; font-weight: bold;">bool</span> isSelectRequired)
{
List<enumlistitem> el = <span style="color: #008800; font-weight: bold;">new</span> List<enumlistitem>();
EnumListItem ei;
<span style="color: #008800; font-weight: bold;">foreach</span> (<span style="color: #333399; font-weight: bold;">int</span> item <span style="color: #008800; font-weight: bold;">in</span> Enum.GetValues(type))
{
ei = GetEnumItem(type, item);
el.Add(ei);
}
<span style="color: #008800; font-weight: bold;">if</span> (isSelectRequired)
{
el.Insert(<span style="color: #6600ee; font-weight: bold;">0</span>, <span style="color: #008800; font-weight: bold;">new</span> EnumListItem(<span style="color: #6600ee; font-weight: bold;">0</span>, <span style="background-color: #fff0f0;">"--Select--"</span>, <span style="background-color: #fff0f0;">"--Select--"</span>));
}
<span style="color: #008800; font-weight: bold;">return</span> el;
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">static</span> EnumListItem <span style="color: #0066bb; font-weight: bold;">GetEnumItem</span>(Type type, <span style="color: #333399; font-weight: bold;">int</span> item)
{
<span style="color: #333399; font-weight: bold;">string</span> name = Enum.GetName(type, item);
<span style="color: #333399; font-weight: bold;">string</span> displayName = <span style="color: #333399; font-weight: bold;">string</span>.Empty;
<span style="color: #333399; font-weight: bold;">object</span>[] displayAttributes = type.GetField(Enum.GetName(type, item)).GetCustomAttributes(<span style="color: #008800; font-weight: bold;">typeof</span>(DisplayValue), <span style="color: #008800; font-weight: bold;">false</span>);
<span style="color: #008800; font-weight: bold;">if</span> (displayAttributes.Length > <span style="color: #6600ee; font-weight: bold;">0</span>)
displayName = ((DisplayValue)displayAttributes[<span style="color: #6600ee; font-weight: bold;">0</span>]).Value;
<span style="color: #008800; font-weight: bold;">else</span>
displayName = name.Replace(<span style="background-color: #fff0f0;">"_"</span>, <span style="background-color: #fff0f0;">" "</span>);
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #0066bb; font-weight: bold;">EnumListItem</span>(item, name, displayName);
}
}
</pre>
</div>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com4tag:blogger.com,1999:blog-8168372949663241132.post-31350496107711883192013-01-16T22:40:00.000-08:002016-09-17T11:23:52.694-07:00Set column editable mode based on another column value changes in kendo UI<div dir="ltr" style="text-align: left;" trbidi="on">
<b>View</b>
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;">@(Html.Kendo().Grid<span style="color: #007700;"><MvcApplication1.Models.TestModels></span>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.ID);
columns.Bound(p => p.Name);
columns.Bound(p => p.IsActive);
columns.ForeignKey(p => p.FID, (System.Collections.IEnumerable)ViewData["TestList"], "Value", "Text");
})
.ToolBar(toolBar => toolBar.Save())
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.Events(e => e.Edit("onGridEdit"))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Events(events => events.Error("errorHandler"))
.Model(model =>
{
model.Id(p => p.ID);
model.Field(p => p.ID).Editable(false);
})
.Read(read => read.Action("ForeignKeyColumn_Read", "Home"))
.Update(update => update.Action("ForeignKeyColumn_Update", "Home"))
)
)
</pre>
</div>
<b>Controller</b>
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #008800; font-weight: bold;">namespace</span> <span style="color: #0e84b5; font-weight: bold;">MvcApplication1.Controllers</span>
{
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">HomeController</span> : Controller
{
<span style="color: #008800; font-weight: bold;">public</span> ActionResult <span style="color: #0066bb; font-weight: bold;">Index</span>()
{
List<SelectListItem> items = <span style="color: #008800; font-weight: bold;">new</span> List<SelectListItem>();
<span style="color: #008800; font-weight: bold;">for</span> (<span style="color: #333399; font-weight: bold;">int</span> i = <span style="color: #6600ee; font-weight: bold;">1</span>; i < <span style="color: #6600ee; font-weight: bold;">6</span>; i++)
{
SelectListItem item = <span style="color: #008800; font-weight: bold;">new</span> SelectListItem();
item.Text = <span style="background-color: #fff0f0;">"text"</span> + i.ToString();
item.Value = i.ToString();
items.Add(item);
}
ViewData[<span style="background-color: #fff0f0;">"TestList"</span>] = items;
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #0066bb; font-weight: bold;">View</span>();
}
<span style="color: #008800; font-weight: bold;">public</span> ActionResult <span style="color: #0066bb; font-weight: bold;">ForeignKeyColumn_Read</span>([DataSourceRequest] DataSourceRequest request)
{
List<TestModels> models = <span style="color: #008800; font-weight: bold;">new</span> List<TestModels>();
<span style="color: #008800; font-weight: bold;">for</span> (<span style="color: #333399; font-weight: bold;">int</span> i = <span style="color: #6600ee; font-weight: bold;">1</span>; i < <span style="color: #6600ee; font-weight: bold;">6</span>; i++)
{
TestModels model = <span style="color: #008800; font-weight: bold;">new</span> TestModels();
model.ID = i;
model.Name = <span style="background-color: #fff0f0;">"Name"</span> + i;
<span style="color: #008800; font-weight: bold;">if</span> (i % <span style="color: #6600ee; font-weight: bold;">2</span> == <span style="color: #6600ee; font-weight: bold;">0</span>)
{
model.IsActive = <span style="color: #008800; font-weight: bold;">true</span>;
model.FID = i;
}
models.Add(model);
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #0066bb; font-weight: bold;">Json</span>(models.ToDataSourceResult(request));
}
<span style="color: #0000cc;"> [AcceptVerbs(HttpVerbs.Post)]</span>
<span style="color: #008800; font-weight: bold;">public</span> ActionResult <span style="color: #0066bb; font-weight: bold;">ForeignKeyColumn_Update</span>([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = <span style="background-color: #fff0f0;">"models"</span>)]IEnumerable<TestModels> tests)
{
<span style="color: #008800; font-weight: bold;">if</span> (tests != <span style="color: #008800; font-weight: bold;">null</span> && ModelState.IsValid)
{
<span style="color: #888888;">// Save/Update logic comes here</span>
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #0066bb; font-weight: bold;">Json</span>(ModelState.ToDataSourceResult());
}
}
}
</pre>
</div>
<b>Model</b>
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #008800; font-weight: bold;">namespace</span> <span style="color: #0e84b5; font-weight: bold;">MvcApplication1.Models</span>
{
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">TestModels</span>
{
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">int</span> ID { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">string</span> Name { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">bool</span> IsActive { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">int</span> FID { <span style="color: #008800; font-weight: bold;">get</span>; <span style="color: #008800; font-weight: bold;">set</span>; }
}
}
</pre>
</div>
<b>JS</b>
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">function</span> errorHandler(e) {
<span style="color: #008800; font-weight: bold;">if</span> (e.errors) {
<span style="color: #008800; font-weight: bold;">var</span> message <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"Errors:\n"</span>;
$.each(e.errors, <span style="color: #008800; font-weight: bold;">function</span> (key, value) {
<span style="color: #008800; font-weight: bold;">if</span> (<span style="background-color: #fff0f0;">'errors'</span> <span style="color: #008800; font-weight: bold;">in</span> value) {
$.each(value.errors, <span style="color: #008800; font-weight: bold;">function</span> () {
message <span style="color: #333333;">+=</span> <span style="color: #008800; font-weight: bold;">this</span> <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">"\n"</span>;
});
}
});
alert(message);
}
}
<span style="color: #008800; font-weight: bold;">function</span> onGridEdit(arg) {
<span style="color: #008800; font-weight: bold;">if</span> (arg.container.find(<span style="background-color: #fff0f0;">"input[name=IsActive]"</span>).length <span style="color: #333333;">></span> <span style="color: #0000dd; font-weight: bold;">0</span>) {
arg.container.find(<span style="background-color: #fff0f0;">"input[name=IsActive]"</span>).click(<span style="color: #008800; font-weight: bold;">function</span> () {
<span style="color: #008800; font-weight: bold;">if</span> ($(<span style="color: #008800; font-weight: bold;">this</span>).is(<span style="background-color: #fff0f0;">":checked"</span>) <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">false</span>) {
arg.container.next().html(<span style="background-color: #fff0f0;">""</span>);
arg.model.FID <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"0"</span>;
}
<span style="color: #008800; font-weight: bold;">else</span> {
arg.model.IsActive <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">true</span>;
$(<span style="background-color: #fff0f0;">"#Grid"</span>).data(<span style="background-color: #fff0f0;">"kendoGrid"</span>).closeCell(arg.container);
$(<span style="background-color: #fff0f0;">"#Grid"</span>).data(<span style="background-color: #fff0f0;">"kendoGrid"</span>).editCell(arg.container.next());
}
});
}
<span style="color: #008800; font-weight: bold;">if</span> (arg.container.find(<span style="background-color: #fff0f0;">"input[name=FID]"</span>).length <span style="color: #333333;">></span> <span style="color: #0000dd; font-weight: bold;">0</span>) {
<span style="color: #008800; font-weight: bold;">if</span> (arg.model.IsActive <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">false</span>) {
$(<span style="background-color: #fff0f0;">"#Grid"</span>).data(<span style="background-color: #fff0f0;">"kendoGrid"</span>).closeCell(arg.container)
}
}
}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
</pre>
</div>
<br />
<a href="https://skydrive.live.com/redir?resid=977B16A5E89A5236!107&authkey=!AIA_AIL-NfmBPBg">DOWNLOAD DEMO</a></div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com4tag:blogger.com,1999:blog-8168372949663241132.post-50693104464225950182012-12-24T03:31:00.001-08:002016-09-05T00:49:06.104-07:00highlight the searched text in RadListBox and move checked items in to top of the list
<b>JS</b>
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #333333"><</span>telerik<span style="color: #333333">:</span>RadCodeBlock ID<span style="color: #333333">=</span><span style="background-color: #fff0f0">"RadCodeBlock1"</span> runat<span style="color: #333333">=</span><span style="background-color: #fff0f0">"server"</span><span style="color: #333333">></span>
<span style="color: #333333"><</span>script type<span style="color: #333333">=</span><span style="background-color: #fff0f0">"text/javascript"</span> language<span style="color: #333333">=</span><span style="background-color: #fff0f0">"javascript"</span><span style="color: #333333">></span>
<span style="color: #008800; font-weight: bold">function</span> onChangeFilterByName(g, text) {
<span style="color: #008800; font-weight: bold">var</span> f <span style="color: #333333">=</span> $find(<span style="background-color: #fff0f0">"<%= RadListBox1.ClientID %>"</span>);
<span style="color: #008800; font-weight: bold">if</span> (f._enableMarkMatches <span style="color: #333333">&&</span> ($telerik.isIE <span style="color: #333333">||</span> $telerik.isChrome)) {
<span style="color: #008800; font-weight: bold">var</span> h <span style="color: #333333">=</span> g.keyCode <span style="color: #333333">==</span> Sys.UI.Key.backspace <span style="color: #333333">||</span> g.keyCode <span style="color: #333333">==</span> Sys.UI.Key.esc <span style="color: #333333">||</span> g.keyCode <span style="color: #333333">==</span> Sys.UI.Key.space <span style="color: #333333">||</span> g.keyCode <span style="color: #333333">==</span> Sys.UI.Key.down <span style="color: #333333">||</span> g.keyCode <span style="color: #333333">==</span> Sys.UI.Key.up;
<span style="color: #008800; font-weight: bold">if</span> (h) {
<span style="color: #008800; font-weight: bold">var</span> j <span style="color: #333333">=</span> f._onKeyPress(g);
g.preventDefault();
<span style="color: #008800; font-weight: bold">if</span> (j) { <span style="color: #008800; font-weight: bold">return</span>; }
}
}
f._onKeyDown(g);
f._onKeyPress(g);
}
<span style="color: #008800; font-weight: bold">function</span> onChangeFilterByName1(txtFilterByName) {
<span style="color: #008800; font-weight: bold">var</span> check <span style="color: #333333">=</span> <span style="color: #0000DD; font-weight: bold">0</span>;
<span style="color: #008800; font-weight: bold">var</span> listbox <span style="color: #333333">=</span> $find(<span style="background-color: #fff0f0">"<%= RadListBox1.ClientID %>"</span>);
<span style="color: #008800; font-weight: bold">var</span> items <span style="color: #333333">=</span> listbox.get_items();
<span style="color: #008800; font-weight: bold">var</span> itemContainsSearchText <span style="color: #333333">=</span> <span style="color: #008800; font-weight: bold">new</span> <span style="color: #007020">Array</span>();
<span style="color: #008800; font-weight: bold">var</span> index <span style="color: #333333">=</span> <span style="color: #0000DD; font-weight: bold">0</span>;
{
<span style="color: #008800; font-weight: bold">for</span> (<span style="color: #008800; font-weight: bold">var</span> i <span style="color: #333333">=</span> <span style="color: #0000DD; font-weight: bold">0</span>; i <span style="color: #333333"><=</span> items.get_count() <span style="color: #333333">-</span> <span style="color: #0000DD; font-weight: bold">1</span>; i<span style="color: #333333">++</span>) {
<span style="color: #008800; font-weight: bold">var</span> item <span style="color: #333333">=</span> items.getItem(i);
<span style="color: #008800; font-weight: bold">if</span> (<span style="color: #333333">!</span>item.get_checked() <span style="color: #333333">&&</span> item.get_text().toLowerCase().startsWith(txtFilterByName.value.toLowerCase())) {
item.scrollIntoView();
item.ensureVisible();
<span style="color: #008800; font-weight: bold">var</span> text <span style="color: #333333">=</span> item.get_text();
<span style="color: #008800; font-weight: bold">var</span> replace <span style="color: #333333">=</span> <span style="color: #007020">String</span>.format(<span style="background-color: #fff0f0">"<span class=\"rlbHighlight\">{0}</span>"</span>, text);
item.set_text(replace);
<span style="color: #888888">//break;</span>
}
}
}
}
<span style="color: #008800; font-weight: bold">function</span> OnClientItemCheckedHandler(sender, eventArgs) {
<span style="color: #008800; font-weight: bold">var</span> item <span style="color: #333333">=</span> eventArgs.get_item();
<span style="color: #008800; font-weight: bold">var</span> checkedItem <span style="color: #333333">=</span> sender.get_checkedItems();
checkedItem.sort(sortAscByText);
<span style="color: #008800; font-weight: bold">var</span> allItems <span style="color: #333333">=</span> sender.get_items().toArray();
<span style="color: #008800; font-weight: bold">for</span> (<span style="color: #008800; font-weight: bold">var</span> i <span style="color: #333333">=</span> <span style="color: #0000DD; font-weight: bold">0</span>; i <span style="color: #333333"><</span> checkedItem.length; i<span style="color: #333333">++</span>) {
sender.reorderItem(checkedItem[i], i);
}
<span style="color: #008800; font-weight: bold">if</span> (<span style="color: #333333">!</span>item.get_checked()) {
<span style="color: #888888">//removed checked items</span>
<span style="color: #008800; font-weight: bold">for</span> (<span style="color: #008800; font-weight: bold">var</span> i <span style="color: #333333">=</span> <span style="color: #0000DD; font-weight: bold">0</span>; i <span style="color: #333333"><</span> checkedItem.length; i<span style="color: #333333">++</span>) {
<span style="color: #008800; font-weight: bold">var</span> index <span style="color: #333333">=</span> allItems.indexOf(checkedItem[i]);
allItems.splice(index, <span style="color: #0000DD; font-weight: bold">1</span>);
}
<span style="color: #888888">//reorder uncheck items.</span>
allItems.sort(sortAscByText);
<span style="color: #008800; font-weight: bold">var</span> index <span style="color: #333333">=</span> checkedItem.length;
<span style="color: #008800; font-weight: bold">for</span> (<span style="color: #008800; font-weight: bold">var</span> i <span style="color: #333333">=</span> <span style="color: #0000DD; font-weight: bold">0</span>; i <span style="color: #333333"><</span> allItems.length; i<span style="color: #333333">++</span>) {
sender.reorderItem(allItems[i], index);
index <span style="color: #333333">=</span> index <span style="color: #333333">+</span> <span style="color: #0000DD; font-weight: bold">1</span>;
}
}
}
<span style="color: #008800; font-weight: bold">function</span> sortAscByText(a, b) {
<span style="color: #008800; font-weight: bold">return</span> a.get_text() <span style="color: #333333">==</span> b.get_text() <span style="color: #333333">?</span> <span style="color: #0000DD; font-weight: bold">0</span> <span style="color: #333333">:</span> a.get_text() <span style="color: #333333"><</span> b.get_text() <span style="color: #333333">?</span> <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">1</span> <span style="color: #333333">:</span> <span style="color: #0000DD; font-weight: bold">1</span>
}
<span style="color: #333333"><</span><span style="color: #FF0000; background-color: #FFAAAA">/script></span>
<span style="color: #333333"><</span><span style="color: #FF0000; background-color: #FFAAAA">/telerik:RadCodeBlock></span>
</pre></div>
<b>ASPX</b>
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #007700"><div></span>
<span style="color: #007700"><asp:TextBox</span> <span style="color: #0000CC">ID=</span><span style="background-color: #fff0f0">"txtSort"</span> <span style="color: #0000CC">runat=</span><span style="background-color: #fff0f0">"server"</span> <span style="color: #0000CC">Width=</span><span style="background-color: #fff0f0">"195px"</span> <span style="color: #0000CC">OnKeyUp=</span><span style="background-color: #fff0f0">"onChangeFilterByName(event,this)"</span><span style="color: #007700">></asp:TextBox><br</span> <span style="color: #007700">/></span>
<span style="color: #007700"><br</span> <span style="color: #007700">/></span>
<span style="color: #007700"><telerik:RadListBox</span> <span style="color: #0000CC">ID=</span><span style="background-color: #fff0f0">"RadListBox1"</span> <span style="color: #0000CC">runat=</span><span style="background-color: #fff0f0">"server"</span> <span style="color: #0000CC">CheckBoxes=</span><span style="background-color: #fff0f0">"true"</span> <span style="color: #0000CC">Width=</span><span style="background-color: #fff0f0">"200px"</span>
<span style="color: #0000CC">Height=</span><span style="background-color: #fff0f0">"200px"</span> <span style="color: #0000CC">SelectionMode=</span><span style="background-color: #fff0f0">"Multiple"</span> <span style="color: #0000CC">TabIndex=</span><span style="background-color: #fff0f0">"1"</span> <span style="color: #0000CC">EnableMarkMatches=</span><span style="background-color: #fff0f0">"true"</span>
<span style="color: #0000CC">OnClientItemChecked=</span><span style="background-color: #fff0f0">"OnClientItemCheckedHandler"</span><span style="color: #007700">></span>
<span style="color: #007700"><Items></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"Argentina"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"1"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"Australia"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"2"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"Brazil"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"3"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"Canada"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"4"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"Chile"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"5"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"China"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"6"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"Egypt"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"7"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"England"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"8"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"France"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"9"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"Germany"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"10"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"India"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"11"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"Indonesia"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"12"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"Kenya"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"13"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"Mexico"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"14"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"New Zealand"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"15"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"><telerik:RadListBoxItem</span> <span style="color: #0000CC">Text=</span><span style="background-color: #fff0f0">"South Africa"</span> <span style="color: #0000CC">Value=</span><span style="background-color: #fff0f0">"16"</span><span style="color: #007700">></telerik:RadListBoxItem></span>
<span style="color: #007700"></Items></span>
<span style="color: #007700"></telerik:RadListBox></span>
<span style="color: #007700"></div></span>
</pre></div>
Output of this code:
<br/>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-DY7ABpsyOTUBLU_RsptPMZBFVOKXD9W6wRIhoGcg7kg4G8jzA0TgeDE3dv4O95bAelYQFy8yLyd6PPEG1BifOgTZyApdE0QmFOwb6Pe_s9WwIWOq3StBeN9U4m4UkvoHrT4sahr1l9g/s1600/picasion.com_f534cb6d5367a02104f48a7635c4251e.gif" imageanchor="1" style=""><img border="0" height="314" width="263" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-DY7ABpsyOTUBLU_RsptPMZBFVOKXD9W6wRIhoGcg7kg4G8jzA0TgeDE3dv4O95bAelYQFy8yLyd6PPEG1BifOgTZyApdE0QmFOwb6Pe_s9WwIWOq3StBeN9U4m4UkvoHrT4sahr1l9g/s320/picasion.com_f534cb6d5367a02104f48a7635c4251e.gif" /></a>
<br/><br/>
This code is contributed form Abidali Suthar [one of the developer in my team].
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com7tag:blogger.com,1999:blog-8168372949663241132.post-41951081014059469762012-12-05T00:17:00.000-08:002014-02-20T09:29:10.891-08:00Apply MCTS (70-480) for Programming in HTML5 with JavaScript and CSS3 Exam At free of cost<div dir="ltr" style="text-align: left;" trbidi="on">
I would like to announce for those entire eager professionals who want to appear / earn MCTS exam certification. By using promo code “<b>HTMLJMP</b>” or "<b>HTMLMPN</b>" in promatric center, you will be appear exam at free of cost (deduct $80 exam fee).<br />
<br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><br />
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}
</style>
<![endif]-->
<br />
<div class="MsoNormal" style="line-height: 15.6pt;">
<span style="font-family: "Helvetica","sans-serif"; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">(Please
get reference from this link: <a href="http://www.microsoftvirtualacademy.com/tracks/developing-html5-apps-jump-start">http://www.microsoftvirtualacademy.com/tracks/developing-html5-apps-jump-start</a>)</span></div>
<br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><br />
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}
</style>
<![endif]-->
<br />
<div class="MsoNormal" style="line-height: 15.6pt;">
<span style="font-family: "Helvetica","sans-serif"; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">Moreover
get reference of exam detail Please go through link,<a href="http://www.microsoft.com/learning/en/us/exam.aspx?id=70-480">http://www.microsoft.com/learning/en/us/exam.aspx?id=70-480</a></span></div>
<br />
For schedule an exam please go through this link : <a href="http://weblogs.asp.net/sreejukg/archive/2013/01/03/get-certified-for-free-microsoft-offers-free-certification-exam-70-480.aspx" target="_blank">http://weblogs.asp.net/sreejukg/archive/2013/01/03/get-certified-for-free-microsoft-offers-free-certification-exam-70-480.aspx</a><br />
<br />
Let me know if you need any further information.<br />
<br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><br />
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com10tag:blogger.com,1999:blog-8168372949663241132.post-56456189327741117072012-11-23T06:37:00.000-08:002016-09-05T00:51:09.827-07:00DENSE_RANK(), RANK() and ROW_NUMBER()
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">CREATE</span> <span style="color: #008800; font-weight: bold">TABLE</span> <span style="color: #333333">#</span>Department(DeptId <span style="color: #007020">int</span> <span style="color: #008800; font-weight: bold">NOT</span> <span style="color: #008800; font-weight: bold">NULL</span>,DeptName nvarchar(<span style="color: #008800; font-weight: bold">max</span>))
<span style="color: #008800; font-weight: bold">CREATE</span> <span style="color: #008800; font-weight: bold">TABLE</span> <span style="color: #333333">#</span>Emp(EmpId <span style="color: #007020">int</span> <span style="color: #008800; font-weight: bold">NOT</span> <span style="color: #008800; font-weight: bold">NULL</span>,DeptId <span style="color: #007020">int</span> <span style="color: #008800; font-weight: bold">NOT</span> <span style="color: #008800; font-weight: bold">NULL</span>,EmpName nvarchar(<span style="color: #008800; font-weight: bold">max</span>),Salary <span style="color: #007020">int</span>)
<span style="color: #008800; font-weight: bold">INSERT</span> <span style="color: #008800; font-weight: bold">INTO</span> <span style="color: #333333">#</span>Department (DeptId,DeptName) <span style="color: #008800; font-weight: bold">values</span>(<span style="color: #0000DD; font-weight: bold">1</span>,<span style="background-color: #fff0f0">'D1'</span>)
<span style="color: #008800; font-weight: bold">INSERT</span> <span style="color: #008800; font-weight: bold">INTO</span> <span style="color: #333333">#</span>Department (DeptId,DeptName) <span style="color: #008800; font-weight: bold">values</span>(<span style="color: #0000DD; font-weight: bold">2</span>,<span style="background-color: #fff0f0">'D2'</span>)
<span style="color: #008800; font-weight: bold">INSERT</span> <span style="color: #008800; font-weight: bold">INTO</span> <span style="color: #333333">#</span>Emp (EmpID,DeptId,EmpName,Salary) <span style="color: #008800; font-weight: bold">values</span>(<span style="color: #0000DD; font-weight: bold">1</span>,<span style="color: #0000DD; font-weight: bold">1</span>,<span style="background-color: #fff0f0">'A1'</span>,<span style="color: #0000DD; font-weight: bold">1000</span>)
<span style="color: #008800; font-weight: bold">INSERT</span> <span style="color: #008800; font-weight: bold">INTO</span> <span style="color: #333333">#</span>Emp (EmpID,DeptId,EmpName,Salary) <span style="color: #008800; font-weight: bold">values</span>(<span style="color: #0000DD; font-weight: bold">2</span>,<span style="color: #0000DD; font-weight: bold">1</span>,<span style="background-color: #fff0f0">'A2'</span>,<span style="color: #0000DD; font-weight: bold">2000</span>)
<span style="color: #008800; font-weight: bold">INSERT</span> <span style="color: #008800; font-weight: bold">INTO</span> <span style="color: #333333">#</span>Emp (EmpID,DeptId,EmpName,Salary) <span style="color: #008800; font-weight: bold">values</span>(<span style="color: #0000DD; font-weight: bold">3</span>,<span style="color: #0000DD; font-weight: bold">1</span>,<span style="background-color: #fff0f0">'A3'</span>,<span style="color: #0000DD; font-weight: bold">1000</span>)
<span style="color: #008800; font-weight: bold">INSERT</span> <span style="color: #008800; font-weight: bold">INTO</span> <span style="color: #333333">#</span>Emp (EmpID,DeptId,EmpName,Salary) <span style="color: #008800; font-weight: bold">values</span>(<span style="color: #0000DD; font-weight: bold">4</span>,<span style="color: #0000DD; font-weight: bold">2</span>,<span style="background-color: #fff0f0">'A4'</span>,<span style="color: #0000DD; font-weight: bold">1000</span>)
<span style="color: #008800; font-weight: bold">INSERT</span> <span style="color: #008800; font-weight: bold">INTO</span> <span style="color: #333333">#</span>Emp (EmpID,DeptId,EmpName,Salary) <span style="color: #008800; font-weight: bold">values</span>(<span style="color: #0000DD; font-weight: bold">5</span>,<span style="color: #0000DD; font-weight: bold">2</span>,<span style="background-color: #fff0f0">'A5'</span>,<span style="color: #0000DD; font-weight: bold">5000</span>)
<span style="color: #008800; font-weight: bold">select</span> dense_rank() over (partition <span style="color: #008800; font-weight: bold">by</span> DeptId <span style="color: #008800; font-weight: bold">order</span> <span style="color: #008800; font-weight: bold">by</span> Salary) [dense_rank],
rank() over (partition <span style="color: #008800; font-weight: bold">by</span> DeptId <span style="color: #008800; font-weight: bold">order</span> <span style="color: #008800; font-weight: bold">by</span> Salary) [rank],
row_number() over (partition <span style="color: #008800; font-weight: bold">by</span> DeptId <span style="color: #008800; font-weight: bold">order</span> <span style="color: #008800; font-weight: bold">by</span> Salary) [row_number],
DeptId,Salary
<span style="color: #008800; font-weight: bold">from</span> <span style="color: #333333">#</span>Emp;
<span style="color: #008800; font-weight: bold">Drop</span> <span style="color: #008800; font-weight: bold">Table</span> <span style="color: #333333">#</span>Emp
<span style="color: #008800; font-weight: bold">Drop</span> <span style="color: #008800; font-weight: bold">Table</span> <span style="color: #333333">#</span>Department
</pre></div>
Output of above code:
<br/><br/>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6VoU7Z-YgRlV4-72G0Y-ihyphenhyphene1ejHk4Qu_UjlJvnys18PLB6ZiXMvkbEf-LX0gadkykXfoFXF8T_bsGajSbEueKNo3YYfbKZ__FomqhulA5Ywx_OLdICJeD6b2fbwIGHT0KGdz7Cz3f9w/s1600/SQL+Row+Number+Difference.png" imageanchor="1" style=""><img border="0" height="148" width="309" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6VoU7Z-YgRlV4-72G0Y-ihyphenhyphene1ejHk4Qu_UjlJvnys18PLB6ZiXMvkbEf-LX0gadkykXfoFXF8T_bsGajSbEueKNo3YYfbKZ__FomqhulA5Ywx_OLdICJeD6b2fbwIGHT0KGdz7Cz3f9w/s320/SQL+Row+Number+Difference.png" /></a>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com0tag:blogger.com,1999:blog-8168372949663241132.post-79428992539904866242012-10-15T01:11:00.000-07:002016-09-05T00:53:41.834-07:00Validate Upload control in KendoUI.cshtml
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #333333"><</span>script type<span style="color: #333333">=</span><span style="background-color: #fff0f0">"text/javascript"</span><span style="color: #333333">></span>
$(<span style="color: #007020">document</span>).ready(<span style="color: #008800; font-weight: bold">function</span> () {
<span style="color: #008800; font-weight: bold">var</span> validator <span style="color: #333333">=</span> $(<span style="background-color: #fff0f0">"#ValidateDemoContainer"</span>).kendoValidator().data(<span style="background-color: #fff0f0">"kendoValidator"</span>);
$(<span style="background-color: #fff0f0">"button"</span>).click(<span style="color: #008800; font-weight: bold">function</span> (e) {
<span style="color: #888888">//Validate Upload Control</span>
<span style="color: #008800; font-weight: bold">if</span> ($(<span style="background-color: #fff0f0">"#UploadedFile"</span>).parent().siblings(<span style="background-color: #fff0f0">"ul"</span>).length <span style="color: #333333">></span> <span style="color: #0000DD; font-weight: bold">0</span>) {
$(<span style="background-color: #fff0f0">"#UploadedFile"</span>).removeAttr(<span style="background-color: #fff0f0">"required"</span>);
}
<span style="color: #888888">//Validate Other control, which inside "ValidateDemoContainer" </span>
<span style="color: #008800; font-weight: bold">if</span> (<span style="color: #333333">!</span>validator.validate()) {
e.preventDefault();
}
});
});
<span style="color: #333333"><</span><span style="color: #FF0000; background-color: #FFAAAA">/script></span>
<span style="color: #007700"><div</span> <span style="color: #0000CC">id=</span><span style="background-color: #fff0f0">"ValidateDemoContainer"</span><span style="color: #007700">></span>
@using (Html.BeginForm("Method", "Controller", FormMethod.Post, new { id = "YourId", enctype = "multipart/form-data"}))
{
@(Html.Kendo().Upload()
.Name("UploadedFile")
.Multiple(false)
.HtmlAttributes(new { required = true })
)
<span style="color: #007700"><br</span> <span style="color: #007700">/></span>
@Html.ValidationMessageFor(m => m.UploadedFile)
<span style="color: #007700"><br</span> <span style="color: #007700">/></span>
<span style="color: #007700"><button</span> <span style="color: #0000CC">class=</span><span style="background-color: #fff0f0">"k-button"</span> <span style="color: #0000CC">type=</span><span style="background-color: #fff0f0">"submit"</span><span style="color: #007700">></span>Submit<span style="color: #007700"></button></span>
}
<span style="color: #007700"></div></span>
</pre></div>
Model
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">YourModel</span>
{
<span style="color: #0000CC"> [Required(ErrorMessage = "Please provide file")]</span>
<span style="color: #008800; font-weight: bold">public</span> System.Web.HttpPostedFileBase UploadedFile { <span style="color: #008800; font-weight: bold">get</span>; <span style="color: #008800; font-weight: bold">set</span>; }
}
</pre></div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com1tag:blogger.com,1999:blog-8168372949663241132.post-90801292159098307142012-10-10T09:04:00.002-07:002016-09-05T00:54:51.073-07:00validation is not working in popup in mvc<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #888888;">// Your open popup code comes here</span>
$(<span style="background-color: #fff0f0;">'UploadActivitySheet'</span>).removeData(<span style="background-color: #fff0f0;">"validator"</span>);
<span style="color: #888888;">//Refresh the validators</span>
$.validator.unobtrusive.parse(<span style="color: #007020;">document</span>);
</pre>
</div>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com0tag:blogger.com,1999:blog-8168372949663241132.post-56101181683405523772012-08-31T23:37:00.000-07:002016-09-05T01:03:48.810-07:00RadGrid with WCF Rest Service<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Create WCF service.</b>
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsE0xyIcsPnYsB7jYaBqW6ykK-U_by-1MVFJLyrDgms1gGEqm-jtPhET3NxFkM5h7SiBzGTnP-UcDDoXY_hobbvpzDBGER01sFz2lyh74vgwID2MTeOUASf_6kijSGx1ClIou-canZWCA/s1600/ServiceProject.png" imageanchor="1"><img border="0" height="157" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsE0xyIcsPnYsB7jYaBqW6ykK-U_by-1MVFJLyrDgms1gGEqm-jtPhET3NxFkM5h7SiBzGTnP-UcDDoXY_hobbvpzDBGER01sFz2lyh74vgwID2MTeOUASf_6kijSGx1ClIou-canZWCA/s320/ServiceProject.png" width="170" /></a>
<br />
<br />
<b>IService1.cs</b>
<br />
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">namespace</span> <span style="color: #0e84b5; font-weight: bold">WcfService1</span>
{
<span style="color: #0000CC"> [ServiceContract]</span>
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">interface</span> IService1
{
<span style="color: #0000CC"> [OperationContract]</span>
<span style="color: #0000CC"> [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)]</span>
ResultData <span style="color: #0066BB; font-weight: bold">GetData</span>(<span style="color: #333399; font-weight: bold">int</span> startRowIndex, <span style="color: #333399; font-weight: bold">int</span> maximumRows, <span style="color: #333399; font-weight: bold">string</span> sortExpression, <span style="color: #333399; font-weight: bold">string</span> filterExpression);
<span style="color: #0000CC"> [OperationContract]</span>
<span style="color: #0000CC"> [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json)]</span>
<span style="color: #333399; font-weight: bold">bool</span> <span style="color: #0066BB; font-weight: bold">SetParameter</span>(<span style="color: #333399; font-weight: bold">string</span> strYourParameter);
}
<span style="color: #0000CC"> </span>
<span style="color: #0000CC"> [DataContract]</span>
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">EmployeeInfo</span>
{
<span style="color: #0000CC"> [DataMember]</span>
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #333399; font-weight: bold">int</span> EmployeeID
{
<span style="color: #008800; font-weight: bold">get</span>;
<span style="color: #008800; font-weight: bold">set</span>;
}
<span style="color: #0000CC"> [DataMember]</span>
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #333399; font-weight: bold">string</span> EmployeeName
{
<span style="color: #008800; font-weight: bold">get</span>;
<span style="color: #008800; font-weight: bold">set</span>;
}
}
}
</pre></div>
<br />
<b>Service1.svc.cs</b>
<br />
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">namespace</span> <span style="color: #0e84b5; font-weight: bold">WcfService1</span>
{
<span style="color: #0000CC"> [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]</span>
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">Service1</span> : IService1
{
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #333399; font-weight: bold">string</span> SearchCriteria
{
<span style="color: #008800; font-weight: bold">set</span>
{
System.Web.HttpContext.Current.Session[<span style="background-color: #fff0f0">"SearchCriteria"</span>] = <span style="color: #008800; font-weight: bold">value</span>;
}
<span style="color: #008800; font-weight: bold">get</span>
{
<span style="color: #008800; font-weight: bold">if</span> (System.Web.HttpContext.Current.Session[<span style="background-color: #fff0f0">"SearchCriteria"</span>] != <span style="color: #008800; font-weight: bold">null</span>)
{
<span style="color: #008800; font-weight: bold">return</span> Convert.ToString(System.Web.HttpContext.Current.Session[<span style="background-color: #fff0f0">"SearchCriteria"</span>]);
}
<span style="color: #008800; font-weight: bold">else</span>
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #008800; font-weight: bold">null</span>;
}
}
<span style="color: #008800; font-weight: bold">public</span> ResultData <span style="color: #0066BB; font-weight: bold">GetData</span>(<span style="color: #333399; font-weight: bold">int</span> startRowIndex, <span style="color: #333399; font-weight: bold">int</span> maximumRows, <span style="color: #333399; font-weight: bold">string</span> sortExpression, <span style="color: #333399; font-weight: bold">string</span> filterExpression)
{
ResultData result = <span style="color: #008800; font-weight: bold">new</span> ResultData();
result.Count = <span style="color: #6600EE; font-weight: bold">0</span>;
<span style="color: #008800; font-weight: bold">if</span> (<span style="color: #008800; font-weight: bold">this</span>.SearchCriteria != <span style="color: #008800; font-weight: bold">null</span>)
{
IQueryable<EmployeeInfo> yourdata = (<span style="color: #008800; font-weight: bold">from</span> p <span style="color: #008800; font-weight: bold">in</span> GenerateData(<span style="color: #008800; font-weight: bold">this</span>.SearchCriteria)
<span style="color: #008800; font-weight: bold">select</span> p).AsQueryable<EmployeeInfo>();
GridLinqBindingData<EmployeeInfo> data = RadGrid.GetBindingData(yourdata, startRowIndex, maximumRows, sortExpression, filterExpression);
result.Data = data.Data.OfType<EmployeeInfo>().Select(p => <span style="color: #008800; font-weight: bold">new</span> EmployeeInfo()
{
EmployeeID = p.EmployeeID,
EmployeeName = p.EmployeeName,
}).ToList();
result.Count = data.Count;
<span style="color: #008800; font-weight: bold">return</span> result;
}
<span style="color: #008800; font-weight: bold">return</span> result;
}
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #333399; font-weight: bold">bool</span> <span style="color: #0066BB; font-weight: bold">SetParameter</span>(<span style="color: #333399; font-weight: bold">string</span> strYourParameter)
{
<span style="color: #008800; font-weight: bold">if</span> (!<span style="color: #333399; font-weight: bold">string</span>.IsNullOrEmpty(strYourParameter))
{
<span style="color: #008800; font-weight: bold">this</span>.SearchCriteria = strYourParameter;
}
<span style="color: #008800; font-weight: bold">else</span>
{
<span style="color: #008800; font-weight: bold">this</span>.SearchCriteria = <span style="color: #008800; font-weight: bold">null</span>;
}
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #008800; font-weight: bold">true</span>;
}
<span style="color: #008800; font-weight: bold">protected</span> List<EmployeeInfo> GenerateData(<span style="color: #333399; font-weight: bold">string</span> parameter)
{
List<EmployeeInfo> empinfo = <span style="color: #008800; font-weight: bold">new</span> List<EmployeeInfo>();
<span style="color: #008800; font-weight: bold">for</span> (<span style="color: #333399; font-weight: bold">int</span> i = <span style="color: #6600EE; font-weight: bold">0</span>; i < <span style="color: #6600EE; font-weight: bold">10</span>; i++)
{
EmployeeInfo employeeInfo = <span style="color: #008800; font-weight: bold">new</span> EmployeeInfo();
employeeInfo.EmployeeID = i;
employeeInfo.EmployeeName = parameter + i.ToString();
empinfo.Add(employeeInfo);
}
<span style="color: #008800; font-weight: bold">for</span> (<span style="color: #333399; font-weight: bold">int</span> i = <span style="color: #6600EE; font-weight: bold">10</span>; i < <span style="color: #6600EE; font-weight: bold">20</span>; i++)
{
EmployeeInfo employeeInfo = <span style="color: #008800; font-weight: bold">new</span> EmployeeInfo();
employeeInfo.EmployeeID = i;
employeeInfo.EmployeeName = parameter + i.ToString();
empinfo.Add(employeeInfo);
}
<span style="color: #008800; font-weight: bold">for</span> (<span style="color: #333399; font-weight: bold">int</span> i = <span style="color: #6600EE; font-weight: bold">20</span>; i < <span style="color: #6600EE; font-weight: bold">30</span>; i++)
{
EmployeeInfo employeeInfo = <span style="color: #008800; font-weight: bold">new</span> EmployeeInfo();
employeeInfo.EmployeeID = i;
employeeInfo.EmployeeName = parameter + i.ToString();
empinfo.Add(employeeInfo);
}
<span style="color: #008800; font-weight: bold">return</span> empinfo;
}
}
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">ResultData</span>
{
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #333399; font-weight: bold">int</span> Count { <span style="color: #008800; font-weight: bold">get</span>; <span style="color: #008800; font-weight: bold">set</span>; }
<span style="color: #008800; font-weight: bold">public</span> List<EmployeeInfo> Data { <span style="color: #008800; font-weight: bold">get</span>; <span style="color: #008800; font-weight: bold">set</span>; }
}
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">enum</span> SortDirection
{
Ascending = <span style="color: #6600EE; font-weight: bold">0</span>,
Descending = <span style="color: #6600EE; font-weight: bold">1</span>
}
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">GenericComparer</span><T> : IComparer<T>
{
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #333399; font-weight: bold">string</span> SortExpression { <span style="color: #008800; font-weight: bold">get</span>; <span style="color: #008800; font-weight: bold">set</span>; }
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #333399; font-weight: bold">int</span> SortDirection { <span style="color: #008800; font-weight: bold">get</span>; <span style="color: #008800; font-weight: bold">set</span>; } <span style="color: #888888">// 0:Ascending, 1:Descending </span>
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #0066BB; font-weight: bold">GenericComparer</span>(<span style="color: #333399; font-weight: bold">string</span> sortExpression, <span style="color: #333399; font-weight: bold">int</span> sortDirection)
{
<span style="color: #008800; font-weight: bold">this</span>.SortExpression = sortExpression;
<span style="color: #008800; font-weight: bold">this</span>.SortDirection = sortDirection;
}
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #0066BB; font-weight: bold">GenericComparer</span>() { }
<span style="color: #557799">#region IComparer<T> Members</span>
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #333399; font-weight: bold">int</span> <span style="color: #0066BB; font-weight: bold">Compare</span>(T x, T y)
{
PropertyInfo propertyInfo = <span style="color: #008800; font-weight: bold">typeof</span>(T).GetProperty(SortExpression);
IComparable obj1 = (IComparable)propertyInfo.GetValue(x, <span style="color: #008800; font-weight: bold">null</span>);
IComparable obj2 = (IComparable)propertyInfo.GetValue(y, <span style="color: #008800; font-weight: bold">null</span>);
<span style="color: #008800; font-weight: bold">if</span> (obj1 == <span style="color: #008800; font-weight: bold">null</span> || obj2 == <span style="color: #008800; font-weight: bold">null</span>) <span style="color: #008800; font-weight: bold">return</span> <span style="color: #6600EE; font-weight: bold">0</span>;
<span style="color: #008800; font-weight: bold">if</span> (SortDirection == <span style="color: #6600EE; font-weight: bold">0</span>)
{
<span style="color: #008800; font-weight: bold">return</span> obj1.CompareTo(obj2);
}
<span style="color: #008800; font-weight: bold">else</span> <span style="color: #008800; font-weight: bold">return</span> obj2.CompareTo(obj1);
}
<span style="color: #557799">#endregion</span>
}
}
</pre></div>
<br />
<b>Web.config</b>
<br />
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #007700"><configuration></span>
<span style="color: #007700"><system</span> <span style="color: #0000CC">.web=</span><span style="background-color: #fff0f0">""</span><span style="color: #007700">></span>
<span style="color: #007700"><compilation</span> <span style="color: #0000CC">debug=</span><span style="background-color: #fff0f0">"true"</span> <span style="color: #0000CC">targetframework=</span><span style="background-color: #fff0f0">"4.0"</span><span style="color: #007700">></span>
<span style="color: #007700"></compilation></system></span>
<span style="color: #007700"><system</span> <span style="color: #0000CC">.servicemodel=</span><span style="background-color: #fff0f0">""</span><span style="color: #007700">></span>
<span style="color: #007700"><bindings></span>
<span style="color: #007700"><webhttpbinding></span>
<span style="color: #007700"><binding</span> <span style="color: #0000CC">allowcookies=</span><span style="background-color: #fff0f0">"false"</span> <span style="color: #0000CC">bypassproxyonlocal=</span><span style="background-color: #fff0f0">"false"</span> <span style="color: #0000CC">closetimeout=</span><span style="background-color: #fff0f0">"00:35:00"</span> <span style="color: #0000CC">crossdomainscriptaccessenabled=</span><span style="background-color: #fff0f0">"true"</span> <span style="color: #0000CC">hostnamecomparisonmode=</span><span style="background-color: #fff0f0">"StrongWildcard"</span> <span style="color: #0000CC">maxbufferpoolsize=</span><span style="background-color: #fff0f0">"2147483647"</span> <span style="color: #0000CC">maxreceivedmessagesize=</span><span style="background-color: #fff0f0">"2147483647"</span> <span style="color: #0000CC">name=</span><span style="background-color: #fff0f0">"RestServiceBinding"</span> <span style="color: #0000CC">opentimeout=</span><span style="background-color: #fff0f0">"00:35:00"</span> <span style="color: #0000CC">receivetimeout=</span><span style="background-color: #fff0f0">"00:35:00"</span> <span style="color: #0000CC">sendtimeout=</span><span style="background-color: #fff0f0">"00:35:00"</span> <span style="color: #0000CC">usedefaultwebproxy=</span><span style="background-color: #fff0f0">"true"</span><span style="color: #007700">></span>
<span style="color: #007700"><readerquotas</span> <span style="color: #0000CC">maxarraylength=</span><span style="background-color: #fff0f0">"2147483647"</span> <span style="color: #0000CC">maxbytesperread=</span><span style="background-color: #fff0f0">"2147483647"</span> <span style="color: #0000CC">maxdepth=</span><span style="background-color: #fff0f0">"2147483647"</span> <span style="color: #0000CC">maxnametablecharcount=</span><span style="background-color: #fff0f0">"2147483647"</span> <span style="color: #0000CC">maxstringcontentlength=</span><span style="background-color: #fff0f0">"2147483647"</span><span style="color: #007700">></span>
<span style="color: #007700"><security</span> <span style="color: #0000CC">mode=</span><span style="background-color: #fff0f0">"None"</span><span style="color: #007700">></span>
<span style="color: #007700"></security></readerquotas></binding></span>
<span style="color: #007700"></webhttpbinding></span>
<span style="color: #007700"></bindings></span>
<span style="color: #007700"><behaviors></span>
<span style="color: #007700"><endpointbehaviors></span>
<span style="color: #007700"><behavior</span> <span style="color: #0000CC">name=</span><span style="background-color: #fff0f0">"RestEndpointBehaviour"</span><span style="color: #007700">></span>
<span style="color: #007700"><webhttp</span> <span style="color: #0000CC">automaticformatselectionenabled=</span><span style="background-color: #fff0f0">"false"</span> <span style="color: #0000CC">defaultoutgoingresponseformat=</span><span style="background-color: #fff0f0">"Json"</span> <span style="color: #0000CC">faultexceptionenabled=</span><span style="background-color: #fff0f0">"true"</span> <span style="color: #0000CC">helpenabled=</span><span style="background-color: #fff0f0">"true"</span><span style="color: #007700">></span>
<span style="color: #007700"></webhttp></behavior></span>
<span style="color: #007700"></endpointbehaviors></span>
<span style="color: #007700"><servicebehaviors></span>
<span style="color: #007700"><behavior</span> <span style="color: #0000CC">name=</span><span style="background-color: #fff0f0">"CommonServiceBehaviour"</span><span style="color: #007700">></span>
<span style="color: #007700"><servicemetadata</span> <span style="color: #0000CC">httpgetenabled=</span><span style="background-color: #fff0f0">"true"</span><span style="color: #007700">></span>
<span style="color: #007700"><servicedebug</span> <span style="color: #0000CC">includeexceptiondetailinfaults=</span><span style="background-color: #fff0f0">"true"</span><span style="color: #007700">></span>
<span style="color: #007700"></servicedebug></servicemetadata></behavior></span>
<span style="color: #007700"></servicebehaviors></span>
<span style="color: #007700"></behaviors></span>
<span style="color: #007700"><services></span>
<span style="color: #007700"><service</span> <span style="color: #0000CC">behaviorconfiguration=</span><span style="background-color: #fff0f0">"CommonServiceBehaviour"</span> <span style="color: #0000CC">name=</span><span style="background-color: #fff0f0">"WcfService1.Service1"</span><span style="color: #007700">></span>
<span style="color: #007700"><endpoint</span> <span style="color: #0000CC">address=</span><span style="background-color: #fff0f0">""</span> <span style="color: #0000CC">behaviorconfiguration=</span><span style="background-color: #fff0f0">"RestEndpointBehaviour"</span> <span style="color: #0000CC">binding=</span><span style="background-color: #fff0f0">"webHttpBinding"</span> <span style="color: #0000CC">bindingconfiguration=</span><span style="background-color: #fff0f0">"RestServiceBinding"</span> <span style="color: #0000CC">contract=</span><span style="background-color: #fff0f0">"WcfService1.IService1"</span><span style="color: #007700">></endpoint></span>
<span style="color: #007700"></service></span>
<span style="color: #007700"></services></span>
<span style="color: #007700"><servicehostingenvironment</span> <span style="color: #0000CC">aspnetcompatibilityenabled=</span><span style="background-color: #fff0f0">"true"</span><span style="color: #007700">></span>
<span style="color: #007700"></servicehostingenvironment></system></span>
<span style="color: #007700"><system</span> <span style="color: #0000CC">.webserver=</span><span style="background-color: #fff0f0">""</span><span style="color: #007700">></span>
<span style="color: #007700"><modules</span> <span style="color: #0000CC">runallmanagedmodulesforallrequests=</span><span style="background-color: #fff0f0">"true"</span><span style="color: #007700">></span>
<span style="color: #007700"></modules></system></span>
<span style="color: #007700"></configuration></span>
</pre></div>
<br />
<b>RestServiceWithRadGrid.aspx</b>
<br />
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #007700"><head</span> <span style="color: #0000CC">runat=</span><span style="background-color: #fff0f0">"server"</span><span style="color: #007700">></span>
<span style="color: #007700"><title></title></span>
<span style="color: #007700"><script</span> <span style="color: #0000CC">src=</span><span style="background-color: #fff0f0">"Scripts/jquery-1.6.2.min.js"</span> <span style="color: #0000CC">type=</span><span style="background-color: #fff0f0">"text/javascript"</span><span style="color: #007700">></script></span>
<span style="color: #007700"><telerik:radcodeblock</span> <span style="color: #0000CC">id=</span><span style="background-color: #fff0f0">"RadCodeBlock1"</span> <span style="color: #0000CC">runat=</span><span style="background-color: #fff0f0">"server"</span><span style="color: #007700">></span>
<span style="color: #007700"><script</span> <span style="color: #0000CC">type=</span><span style="background-color: #fff0f0">"text/javascript"</span><span style="color: #007700">></span>
<span style="color: #333399; font-weight: bold">var</span> UrlForsetParameter = <span style="color: #FF0000; background-color: #FFAAAA">'</span>http:<span style="color: #888888">//localhost/WcfService1/Service1.svc/SetParameter';</span>
function <span style="color: #0066BB; font-weight: bold">Setserachparameter</span>() {
<span style="color: #333399; font-weight: bold">var</span> RadTextBox1 = <span style="color: #FF0000; background-color: #FFAAAA">$</span>find(<span style="background-color: #fff0f0">"<%= RadTextBox1.ClientID %>"</span>);
<span style="color: #333399; font-weight: bold">var</span> strYourParameter = RadTextBox1.get_value();
jQuery.ajax({
type: <span style="background-color: #fff0f0">"POST"</span>,
contentType: <span style="background-color: #fff0f0">"application/json; charset=utf-8"</span>,
data: JSON.stringify(strYourParameter),
dataType: <span style="background-color: #fff0f0">"json"</span>,
url: UrlForsetParameter,
success: function (Responce) {
<span style="color: #333399; font-weight: bold">var</span> grid = <span style="color: #FF0000; background-color: #FFAAAA">$</span>find(<span style="background-color: #fff0f0">"<%=RadGrid1.ClientID %>"</span>);
<span style="color: #333399; font-weight: bold">var</span> MasterTable = grid.get_masterTableView();
MasterTable.rebind();
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #008800; font-weight: bold">false</span>;
}
<span style="color: #007700"></script></span>
<span style="color: #007700"></telerik:radcodeblock></span>
<span style="color: #007700"></head></span>
<span style="color: #007700"><body></span>
<span style="color: #007700"><form</span> <span style="color: #0000CC">id=</span><span style="background-color: #fff0f0">"form1"</span> <span style="color: #0000CC">runat=</span><span style="background-color: #fff0f0">"server"</span><span style="color: #007700">></span>
<span style="color: #007700"><div></span>
<span style="color: #007700"><telerik:radscriptmanager</span> <span style="color: #0000CC">id=</span><span style="background-color: #fff0f0">"RadScriptManager1"</span> <span style="color: #0000CC">runat=</span><span style="background-color: #fff0f0">"server"</span><span style="color: #007700">></span>
<span style="color: #007700"></telerik:radscriptmanager></span>
<span style="color: #007700"><table></span>
<span style="color: #007700"><tr></span>
<span style="color: #007700"><td></span>
Search Text
<span style="color: #007700"></td></span>
<span style="color: #007700"><td></span>
<span style="color: #007700"><telerik:radtextbox</span> <span style="color: #0000CC">id=</span><span style="background-color: #fff0f0">"RadTextBox1"</span> <span style="color: #0000CC">runat=</span><span style="background-color: #fff0f0">"server"</span><span style="color: #007700">></span>
<span style="color: #007700"></telerik:radtextbox></span>
<span style="color: #007700"></td></span>
<span style="color: #007700"></tr></span>
<span style="color: #007700"><tr></span>
<span style="color: #007700"><td</span> <span style="color: #0000CC">colspan=</span><span style="background-color: #fff0f0">"2"</span><span style="color: #007700">></span>
<span style="color: #007700"><asp:button</span> <span style="color: #0000CC">id=</span><span style="background-color: #fff0f0">"Button1"</span> <span style="color: #0000CC">onclientclick=</span><span style="background-color: #fff0f0">"Setserachparameter();"</span> <span style="color: #0000CC">runat=</span><span style="background-color: #fff0f0">"server"</span> <span style="color: #0000CC">text=</span><span style="background-color: #fff0f0">"Get Record"</span><span style="color: #007700">></span>
<span style="color: #007700"></asp:button></td></span>
<span style="color: #007700"></tr></span>
<span style="color: #007700"></table></span>
<span style="color: #007700"><telerik:radgrid</span> <span style="color: #0000CC">allowpaging=</span><span style="background-color: #fff0f0">"true"</span> <span style="color: #0000CC">allowsorting=</span><span style="background-color: #fff0f0">"true"</span> <span style="color: #0000CC">autogeneratecolumns=</span><span style="background-color: #fff0f0">"false"</span> <span style="color: #0000CC">id=</span><span style="background-color: #fff0f0">"RadGrid1"</span> <span style="color: #0000CC">runat=</span><span style="background-color: #fff0f0">"server"</span><span style="color: #007700">></span>
<span style="color: #007700"><pagerstyle</span> <span style="color: #0000CC">alwaysvisible=</span><span style="background-color: #fff0f0">"true"</span><span style="color: #007700">></span>
<span style="color: #007700"><mastertableview></span>
<span style="color: #007700"><columns></span>
<span style="color: #007700"><telerik:gridboundcolumn</span> <span style="color: #0000CC">datafield=</span><span style="background-color: #fff0f0">"EmployeeID"</span> <span style="color: #0000CC">headertext=</span><span style="background-color: #fff0f0">"EmployeeID"</span> <span style="color: #0000CC">uniquename=</span><span style="background-color: #fff0f0">"EmployeeID"</span><span style="color: #007700">></span>
<span style="color: #007700"></telerik:gridboundcolumn></span>
<span style="color: #007700"><telerik:gridboundcolumn</span> <span style="color: #0000CC">datafield=</span><span style="background-color: #fff0f0">"EmployeeName"</span> <span style="color: #0000CC">headertext=</span><span style="background-color: #fff0f0">"EmployeeName"</span> <span style="color: #0000CC">uniquename=</span><span style="background-color: #fff0f0">"EmployeeName"</span><span style="color: #007700">></span>
<span style="color: #007700"></telerik:gridboundcolumn></span>
<span style="color: #007700"></columns></span>
<span style="color: #007700"></mastertableview></span>
<span style="color: #007700"><clientsettings></span>
<span style="color: #007700"><databinding</span> <span style="color: #0000CC">filterparametertype=</span><span style="background-color: #fff0f0">"Linq"</span> <span style="color: #0000CC">location=</span><span style="background-color: #fff0f0">"http://localhost/WcfService1/Service1.svc"</span> <span style="color: #0000CC">selectmethod=</span><span style="background-color: #fff0f0">"GetData"</span> <span style="color: #0000CC">sortparametertype=</span><span style="background-color: #fff0f0">"Linq"</span><span style="color: #007700">></span>
<span style="color: #007700"></databinding></span>
<span style="color: #007700"></clientsettings></span>
<span style="color: #007700"></pagerstyle></telerik:radgrid></span>
<span style="color: #007700"></div></span>
<span style="color: #007700"></form></span>
<span style="color: #007700"></body></span>
<span style="color: #007700"></html></span>
</pre></div>
You can also check <a href="http://www.telerik.com/help/aspnet-ajax/grid-client-side-binding-to-wcf-service-adonet-dataservice.html">this(Client Binding to WCF Web Service)</a> link for more information.
<br />
<br />
As per above link we can able to binding our RadGrid with WCF service. But in some case we have to use more parameters in method (GetDataAndCount()) At that time you can try with above code.
<br />
<br />
In this code i have take one session properties in at service level. On button click i have set parameter in service's session property. Then after i rebind my RadGrid, so it will called method(GetDataAndCount()) in this, by using session property first of all get the specific data from DB/Generate dummy data then apply grid's parameter in it.
<br />
<br />
You can also check output in below image.
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMam7nbr3XqdWsEEP1YWZVZT4qN1VirnpXhS1ntz9pG7PY-L3ybWiZ3X16DcaX5-dRxSjZo6AG6m7DuV1HLRKt-X8OFDGSwKEyizjWzz-Ii2uSCFRLqeZTW79EGJ5e02DDDBJidTuYtF0/s1600/Output.png" imageanchor="1"><img border="0" height="169" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMam7nbr3XqdWsEEP1YWZVZT4qN1VirnpXhS1ntz9pG7PY-L3ybWiZ3X16DcaX5-dRxSjZo6AG6m7DuV1HLRKt-X8OFDGSwKEyizjWzz-Ii2uSCFRLqeZTW79EGJ5e02DDDBJidTuYtF0/s320/Output.png" width="320" /></a>
<br />
<br />
<a href="https://skydrive.live.com/?cid=977b16a5e89a5236&id=977B16A5E89A5236%21120&authkey=!AIqCRiaN-qg674w">DOWNLOAD DEMO</a></div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com10tag:blogger.com,1999:blog-8168372949663241132.post-20050627180493288282012-07-27T01:53:00.000-07:002016-09-05T01:17:41.470-07:00Access RadGrid Row and Column on Client Side<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Get Client Data key on Client</b>
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>telerik<span style="color: #333333;">:</span>radcodeblock id<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"RadCodeBlock1"</span> runat<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #333333;">></span>
<span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">function</span> AccessOnclient() {
<span style="color: #008800; font-weight: bold;">var</span> grid <span style="color: #333333;">=</span> $find(<span style="background-color: #fff0f0;">"<%= RadGrid1.ClientID %>"</span>);
<span style="color: #008800; font-weight: bold;">if</span> (grid) {
<span style="color: #008800; font-weight: bold;">var</span> MasterTable <span style="color: #333333;">=</span> grid.get_masterTableView();
<span style="color: #008800; font-weight: bold;">var</span> Rows <span style="color: #333333;">=</span> MasterTable.get_dataItems();
<span style="color: #008800; font-weight: bold;">for</span> (<span style="color: #008800; font-weight: bold;">var</span> i <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>; i <span style="color: #333333;"><</span> Rows.length; i<span style="color: #333333;">++</span>) {
<span style="color: #008800; font-weight: bold;">var</span> row <span style="color: #333333;">=</span> Rows[i];
<span style="color: #008800; font-weight: bold;">var</span> ClientDataKey_ID <span style="color: #333333;">=</span> row.getDataKeyValue(<span style="background-color: #fff0f0;">"ID"</span>);
}
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">false</span>;
}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/telerik:radcodeblock></span>
</pre>
</div>
<b>Get Template Column Control</b>
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>telerik<span style="color: #333333;">:</span>radcodeblock id<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"RadCodeBlock1"</span> runat<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #333333;">></span>
<span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">function</span> AccessOnclient() {
<span style="color: #008800; font-weight: bold;">var</span> grid <span style="color: #333333;">=</span> $find(<span style="background-color: #fff0f0;">"<%= RadGrid1.ClientID %>"</span>);
<span style="color: #008800; font-weight: bold;">if</span> (grid) {
<span style="color: #008800; font-weight: bold;">var</span> MasterTable <span style="color: #333333;">=</span> grid.get_masterTableView();
<span style="color: #008800; font-weight: bold;">var</span> Rows <span style="color: #333333;">=</span> MasterTable.get_dataItems();
<span style="color: #008800; font-weight: bold;">for</span> (<span style="color: #008800; font-weight: bold;">var</span> i <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>; i <span style="color: #333333;"><</span> Rows.length; i<span style="color: #333333;">++</span>) {
<span style="color: #008800; font-weight: bold;">var</span> row <span style="color: #333333;">=</span> Rows[i];
<span style="color: #888888;">// Method1</span>
<span style="color: #008800; font-weight: bold;">var</span> lblName_1 <span style="color: #333333;">=</span> $(row.get_element()).find(<span style="background-color: #fff0f0;">"span[id*='lblName']"</span>).get(<span style="color: #0000dd; font-weight: bold;">0</span>);
<span style="color: #888888;">// Method2</span>
<span style="color: #008800; font-weight: bold;">var</span> lblName_2 <span style="color: #333333;">=</span> $telerik.findControl(row.get_element(), <span style="background-color: #fff0f0;">"lblName"</span>);
<span style="color: #888888;">// Method3</span>
<span style="color: #008800; font-weight: bold;">var</span> lblName_3 <span style="color: #333333;">=</span> row.findControl(<span style="background-color: #fff0f0;">"lblName"</span>);
}
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">false</span>;
}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/telerik:radcodeblock></span>
</pre>
</div>
<b>Access Column Text</b>
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>telerik<span style="color: #333333;">:</span>radcodeblock id<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"RadCodeBlock1"</span> runat<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #333333;">></span>
<span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">function</span> AccessOnclient() {
<span style="color: #008800; font-weight: bold;">var</span> grid <span style="color: #333333;">=</span> $find(<span style="background-color: #fff0f0;">"<%= RadGrid1.ClientID %>"</span>);
<span style="color: #008800; font-weight: bold;">if</span> (grid) {
<span style="color: #008800; font-weight: bold;">var</span> MasterTable <span style="color: #333333;">=</span> grid.get_masterTableView();
<span style="color: #008800; font-weight: bold;">var</span> Rows <span style="color: #333333;">=</span> MasterTable.get_dataItems();
<span style="color: #008800; font-weight: bold;">for</span> (<span style="color: #008800; font-weight: bold;">var</span> i <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>; i <span style="color: #333333;"><</span> Rows.length; i<span style="color: #333333;">++</span>) {
<span style="color: #008800; font-weight: bold;">var</span> row <span style="color: #333333;">=</span> Rows[i];
<span style="color: #888888;">// Method1</span>
<span style="color: #008800; font-weight: bold;">var</span> getCellText_1 <span style="color: #333333;">=</span> row.get_element().cells[<span style="color: #0000dd; font-weight: bold;">0</span>].innerHTML;
<span style="color: #888888;">// Method2</span>
<span style="color: #008800; font-weight: bold;">var</span> getCellText_2 <span style="color: #333333;">=</span> row.get_cell(<span style="background-color: #fff0f0;">"ID"</span>).innerHTML;
<span style="color: #888888;">// Method3</span>
<span style="color: #008800; font-weight: bold;">var</span> getCellText_2 <span style="color: #333333;">=</span> row.get_cell(<span style="background-color: #fff0f0;">"Name"</span>).getElementsByTagName(<span style="background-color: #fff0f0;">"span"</span>)[<span style="color: #0000dd; font-weight: bold;">0</span>].innerHTML; <span style="color: #888888;">//this code also work for Checkboxcolunm, hyperlinkcolumn...etc</span>
}
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">false</span>;
}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/telerik:radcodeblock></span>
</pre>
</div>
<b>Access Column's property here</b>
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>telerik<span style="color: #333333;">:</span>radcodeblock id<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"RadCodeBlock1"</span> runat<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #333333;">></span>
<span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">function</span> AccessOnclient() {
<span style="color: #008800; font-weight: bold;">var</span> grid <span style="color: #333333;">=</span> $find(<span style="background-color: #fff0f0;">"<%= RadGrid1.ClientID %>"</span>);
<span style="color: #008800; font-weight: bold;">if</span> (grid) {
<span style="color: #008800; font-weight: bold;">var</span> MasterTable <span style="color: #333333;">=</span> grid.get_masterTableView();
<span style="color: #008800; font-weight: bold;">var</span> Columns <span style="color: #333333;">=</span> MasterTable.get_columns();
<span style="color: #008800; font-weight: bold;">for</span> (<span style="color: #008800; font-weight: bold;">var</span> i <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>; i <span style="color: #333333;"><</span> Columns.length; i<span style="color: #333333;">++</span>) {
<span style="color: #008800; font-weight: bold;">var</span> column <span style="color: #333333;">=</span> Columns[<span style="color: #0000dd; font-weight: bold;">0</span>];
<span style="color: #008800; font-weight: bold;">var</span> columnUniqueName <span style="color: #333333;">=</span> column.get_uniqueName();
<span style="color: #008800; font-weight: bold;">var</span> columnDataField <span style="color: #333333;">=</span> column.get_dataField();
<span style="color: #008800; font-weight: bold;">var</span> columnfilterFunction <span style="color: #333333;">=</span> column.get_filterFunction();
}
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">false</span>;
}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/telerik:radcodeblock></span>
</pre>
</div>
<b>Access Control in Edit mode</b>
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>telerik<span style="color: #333333;">:</span>radcodeblock id<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"RadCodeBlock1"</span> runat<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #333333;">></span>
<span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">function</span> AccessOnclient() {
<span style="color: #008800; font-weight: bold;">var</span> grid <span style="color: #333333;">=</span> $find(<span style="background-color: #fff0f0;">"<%= RadGrid1.ClientID %>"</span>);
<span style="color: #008800; font-weight: bold;">if</span> (grid) {
<span style="color: #008800; font-weight: bold;">var</span> EditItems <span style="color: #333333;">=</span> grid.get_editItems();
<span style="color: #008800; font-weight: bold;">for</span> (<span style="color: #008800; font-weight: bold;">var</span> i <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">0</span>; i <span style="color: #333333;"><</span> EditItems.length; i<span style="color: #333333;">++</span>) {
<span style="color: #008800; font-weight: bold;">var</span> editItem <span style="color: #333333;">=</span> EditItems[<span style="color: #0000dd; font-weight: bold;">0</span>];
<span style="color: #008800; font-weight: bold;">var</span> checkbox1 <span style="color: #333333;">=</span> $(editItem.get_editFormItem()).find(<span style="background-color: #fff0f0;">"input[id*='CheckBox1']"</span>).get(<span style="color: #0000dd; font-weight: bold;">0</span>)
}
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">false</span>;
}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/telerik:radcodeblock></span>
</pre>
</div>
<b>Access Control in insert mode</b>
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #333333;"><</span>telerik<span style="color: #333333;">:</span>radcodeblock id<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"RadCodeBlock1"</span> runat<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #333333;">></span>
<span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">function</span> AccessOnclient() {
<span style="color: #008800; font-weight: bold;">var</span> grid <span style="color: #333333;">=</span> $find(<span style="background-color: #fff0f0;">"<%= RadGrid1.ClientID %>"</span>);
<span style="color: #008800; font-weight: bold;">if</span> (grid) {
<span style="color: #008800; font-weight: bold;">var</span> MasterTable <span style="color: #333333;">=</span> grid.get_masterTableView();
<span style="color: #008800; font-weight: bold;">var</span> insertRow <span style="color: #333333;">=</span> MasterTable.get_insertItem();
<span style="color: #008800; font-weight: bold;">var</span> checkbox1 <span style="color: #333333;">=</span> $(insertRow).find(<span style="background-color: #fff0f0;">"input[id*='CheckBox1']"</span>).get(<span style="color: #0000dd; font-weight: bold;">0</span>);
<span style="color: #888888;">//You can access other controls from below container</span>
<span style="color: #888888;">//$(insertRow)</span>
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">false</span>;
}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/telerik:radcodeblock></span>
</pre>
</div>
<b>ASPX</b>
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #007700;"><telerik:radscriptmanager</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"RadScriptManager1"</span> <span style="color: #0000cc;">runat=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></telerik:radscriptmanager></span>
<span style="color: #007700;"><telerik:radajaxmanager</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"RadAjaxManager1"</span> <span style="color: #0000cc;">runat=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></telerik:radajaxmanager></span>
<span style="color: #007700;"><telerik:radajaxloadingpanel</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"RadAjaxLoadingPanel1"</span> <span style="color: #0000cc;">runat=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></telerik:radajaxloadingpanel></span>
<span style="color: #007700;"><asp:button</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Button1"</span> <span style="color: #0000cc;">onclientclick=</span><span style="background-color: #fff0f0;">"return AccessOnclient();"</span> <span style="color: #0000cc;">runat=</span><span style="background-color: #fff0f0;">"server"</span> <span style="color: #0000cc;">text=</span><span style="background-color: #fff0f0;">"Access On Client"</span><span style="color: #007700;">></asp:button></span>
<span style="color: #007700;"><telerik:radgrid</span> <span style="color: #0000cc;">allowfilteringbycolumn=</span><span style="background-color: #fff0f0;">"true"</span> <span style="color: #0000cc;">autogeneratecolumns=</span><span style="background-color: #fff0f0;">"false"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"RadGrid1"</span> <span style="color: #0000cc;">onneeddatasource=</span><span style="background-color: #fff0f0;">"RadGrid1_NeedDataSource"</span> <span style="color: #0000cc;">runat=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><mastertableview</span> <span style="color: #0000cc;">clientdatakeynames=</span><span style="background-color: #fff0f0;">"ID"</span> <span style="color: #0000cc;">commanditemdisplay=</span><span style="background-color: #fff0f0;">"Top"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><columns></span>
<span style="color: #007700;"><telerik:gridboundcolumn</span> <span style="color: #0000cc;">datafield=</span><span style="background-color: #fff0f0;">"ID"</span> <span style="color: #0000cc;">headertext=</span><span style="background-color: #fff0f0;">"ID"</span> <span style="color: #0000cc;">uniquename=</span><span style="background-color: #fff0f0;">"ID"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></telerik:gridboundcolumn></span>
<span style="color: #007700;"><telerik:gridtemplatecolumn</span> <span style="color: #0000cc;">headertext=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">uniquename=</span><span style="background-color: #fff0f0;">"Name"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><itemtemplate></span>
<span style="color: #007700;"><asp:label</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"lblName"</span> <span style="color: #0000cc;">runat=</span><span style="background-color: #fff0f0;">"server"</span> <span style="color: #0000cc;">text=</span><span style="background-color: #fff0f0;">"&lt;%# Eval(&quot;Name&quot;) %&gt;"</span><span style="color: #007700;">></asp:label></span>
<span style="color: #007700;"></itemtemplate></span>
<span style="color: #007700;"><edititemtemplate></span>
<span style="color: #007700;"><asp:checkbox</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"CheckBox1"</span> <span style="color: #0000cc;">runat=</span><span style="background-color: #fff0f0;">"server"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></asp:checkbox></edititemtemplate></span>
<span style="color: #007700;"></telerik:gridtemplatecolumn></span>
<span style="color: #007700;"><telerik:grideditcommandcolumn</span> <span style="color: #0000cc;">uniquename=</span><span style="background-color: #fff0f0;">"EditColumn"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></telerik:grideditcommandcolumn></span>
<span style="color: #007700;"></columns></span>
<span style="color: #007700;"></mastertableview></span>
<span style="color: #007700;"></telerik:radgrid></span>
</pre>
</div>
<b>ASPX.CS</b>
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"> <span style="color: #008800; font-weight: bold;">protected</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">RadGrid1_NeedDataSource</span>(<span style="color: #333399; font-weight: bold;">object</span> sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
<span style="color: #333399; font-weight: bold;">dynamic</span> data = <span style="color: #008800; font-weight: bold;">new</span>[] {
<span style="color: #008800; font-weight: bold;">new</span> { ID = <span style="color: #6600ee; font-weight: bold;">1</span>, Name =<span style="background-color: #fff0f0;">"Name_1"</span>},
<span style="color: #008800; font-weight: bold;">new</span> { ID = <span style="color: #6600ee; font-weight: bold;">2</span>, Name = <span style="background-color: #fff0f0;">"Name_2"</span>},
<span style="color: #008800; font-weight: bold;">new</span> { ID = <span style="color: #6600ee; font-weight: bold;">3</span>, Name = <span style="background-color: #fff0f0;">"Name_3"</span>},
<span style="color: #008800; font-weight: bold;">new</span> { ID = <span style="color: #6600ee; font-weight: bold;">4</span>, Name = <span style="background-color: #fff0f0;">"Name_4"</span>},
<span style="color: #008800; font-weight: bold;">new</span> { ID = <span style="color: #6600ee; font-weight: bold;">5</span>, Name = <span style="background-color: #fff0f0;">"Name_5"</span>}
};
RadGrid1.DataSource = data;
}
</pre>
</div>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com31tag:blogger.com,1999:blog-8168372949663241132.post-33518402190782733272012-07-06T09:26:00.000-07:002012-07-06T23:12:13.529-07:00Visual Studio 2012 and ASP.NET 4.5 Features<div dir="ltr" style="text-align: left;" trbidi="on">
You can find information about new features and enhancements in Visual
Studio 2012 and ASP.NET 4.5 by reviewing the below Ebook.<br />
<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<span style="font-size: large;"><b><a href="http://www.telerik.com/campaigns/visual-studio-2012.aspx?utm_source=MVPs&utm_medium=blog&utm_campaign=VS11_ebook_july2012" target="_blank">Download the Free Ebook</a></b></span><br />
<div style="color: #3d85c6;">
<br /></div>
<br />
<br /></div>Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com11tag:blogger.com,1999:blog-8168372949663241132.post-6120749758951661092012-07-06T05:53:00.003-07:002016-09-05T01:19:56.829-07:00Access Another control which was in same level or in row<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"> <span style="color: #008800; font-weight: bold;">function</span> YourFunctionName(sender, args) {
<span style="color: #888888;">// Do not forget to add jquery in reference</span>
<span style="color: #008800; font-weight: bold;">var</span> SenderId <span style="color: #333333;">=</span> sender.id;
<span style="color: #888888;">//var SenderId = sender.get_element().id;</span>
<span style="color: #888888;">//var SenderId = sender.get_id();</span>
<span style="color: #008800; font-weight: bold;">var</span> RadTextBox1 <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"#"</span> <span style="color: #333333;">+</span> SenderId).get(<span style="color: #0000dd; font-weight: bold;">0</span>);
<span style="color: #008800; font-weight: bold;">var</span> RadTextBox2 <span style="color: #333333;">=</span> $(<span style="background-color: #fff0f0;">"#"</span> <span style="color: #333333;">+</span> SenderId.replace(<span style="background-color: #fff0f0;">"RadTextBox1"</span>, <span style="background-color: #fff0f0;">"RadTextBox2"</span>)).get(<span style="color: #0000dd; font-weight: bold;">0</span>);
<span style="color: #888888;">// for telerik /radcontrols</span>
<span style="color: #008800; font-weight: bold;">var</span> RadTextBox2 <span style="color: #333333;">=</span> $telerik.findTextBox(SenderId.replace(<span style="background-color: #fff0f0;">"RadTextBox1"</span>, <span style="background-color: #fff0f0;">"RadTextBox2"</span>));
}
</pre>
</div>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com1tag:blogger.com,1999:blog-8168372949663241132.post-404731907908654312012-06-26T06:18:00.000-07:002016-09-05T01:21:43.621-07:00Space added in autoGenerated column header problem in Radgrid<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #008800; font-weight: bold;">protected</span> <span style="color: #008800; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">RadGrid1_ColumnCreated</span>(<span style="color: #333399; font-weight: bold;">object</span> sender, GridColumnCreatedEventArgs e)
{
<span style="color: #008800; font-weight: bold;">if</span> (!<span style="color: #333399; font-weight: bold;">string</span>.IsNullOrEmpty(e.Column.UniqueName) && !<span style="color: #333399; font-weight: bold;">string</span>.IsNullOrEmpty(e.Column.HeaderText))
e.Column.HeaderText = e.Column.UniqueName;
<span style="color: #888888;">//OR</span>
e.Column.HeaderText = e.Column.HeaderText.Replace(<span style="background-color: #fff0f0;">" "</span>, <span style="background-color: #fff0f0;">""</span>);
}
</pre>
</div>
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com0tag:blogger.com,1999:blog-8168372949663241132.post-35577065302859287682012-06-20T07:07:00.002-07:002016-09-05T01:24:20.895-07:00Customizing items of RadGrid page size combo based on total records
Telerik provides the easy to use RadGrid control with inbuilt paging feature.<br />
<br />
By default paging combo includes 10, 20 and 50 page sizes, regardless of number of records displayed in the grid (i.e. if records counts to 11 then also page size combo displays 10, 20 and 50).<br />
<br />
If we want to customize the page size combo items to show<br />
<br />
<ul style="text-align: left;">
<li> Records count > 10 then page size items should show 10 and 20 </li>
<li> Records count >= 20 then page size items should show 10, 20 and 50</li>
</ul>
<br />
In order to achieve the above functionality, we will be using RadGrid ItemCreated and ItemEvent events, refer the below code.<br />
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">private</span> <span style="color: #333399; font-weight: bold">int</span> totalItemCount;
<span style="color: #008800; font-weight: bold">protected</span> <span style="color: #008800; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">RadGrid1_ItemEvent</span>(<span style="color: #333399; font-weight: bold">object</span> sender, GridItemEventArgs e)
{
<span style="color: #008800; font-weight: bold">if</span> (e.EventInfo <span style="color: #008800; font-weight: bold">is</span> GridInitializePagerItem)
{
totalItemCount = (e.EventInfo <span style="color: #008800; font-weight: bold">as</span> GridInitializePagerItem).PagingManager.DataSourceCount;
}
}
<span style="color: #008800; font-weight: bold">protected</span> <span style="color: #008800; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">RadGrid1_ItemCreated</span>(<span style="color: #333399; font-weight: bold">object</span> sender, Telerik.Web.UI.GridItemEventArgs e)
{
<span style="color: #008800; font-weight: bold">if</span> (e.Item <span style="color: #008800; font-weight: bold">is</span> GridPagerItem)
{
GridPagerItem pagerItem = (GridPagerItem)e.Item;
RadComboBox pageSizeCombo = (RadComboBox)pagerItem.FindControl(<span style="background-color: #fff0f0">"PageSizeComboBox"</span>);
<span style="color: #008800; font-weight: bold">for</span> (<span style="color: #333399; font-weight: bold">int</span> i = <span style="color: #6600EE; font-weight: bold">0</span>; i &lt; pageSizeCombo.Items.Count; i++)
{
RadComboBoxItem item = pageSizeCombo.Items[i];
<span style="color: #008800; font-weight: bold">if</span> (Convert.ToInt32(item.Value) &gt; totalItemCount)
{
i--;
pageSizeCombo.Items.Remove(item.Index);
}
}
<span style="color: #008800; font-weight: bold">if</span> (totalItemCount != Convert.ToInt32(pageSizeCombo.Items[pageSizeCombo.Items.Count - <span style="color: #6600EE; font-weight: bold">1</span>].Value))
{
RadComboBoxItem item = <span style="color: #008800; font-weight: bold">new</span> RadComboBoxItem();
item = <span style="color: #008800; font-weight: bold">new</span> RadComboBoxItem(totalItemCount.ToString(), totalItemCount.ToString());
item.Attributes.Add(<span style="background-color: #fff0f0">"ownerTableViewId"</span>, e.Item.OwnerTableView.ClientID);
pageSizeCombo.Items.Add(item);
}
<span style="color: #888888">// If you lost selected value in Pagesize combo</span>
<span style="color: #888888">//pageSizeCombo.FindItemByValue(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;</span>
}
}
</pre></div>
Displaying page combo always regardless of number of records, refer below code
<br />
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #007700"><telerik:radgrid</span> <span style="color: #0000CC">allowpaging=</span><span style="background-color: #fff0f0">"true"</span> <span style="color: #0000CC">id=</span><span style="background-color: #fff0f0">"RadGrid1"</span> <span style="color: #0000CC">runat=</span><span style="background-color: #fff0f0">"server"</span><span style="color: #007700">></span>
<span style="color: #007700"><mastertableview></span>
<span style="color: #007700"><pagerstyle</span> <span style="color: #0000CC">alwaysvisible=</span><span style="background-color: #fff0f0">"true"</span><span style="color: #007700">></pagerstyle></span>
. . . .
. . . .
<span style="color: #007700"></mastertableview></span>
<span style="color: #007700"></telerik:radgrid></span>
</pre></div>
Showing "Show All" option in page size combo, refer below combo
<br />
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">private</span> <span style="color: #333399; font-weight: bold">int</span> totalItemCount;
<span style="color: #008800; font-weight: bold">protected</span> <span style="color: #008800; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">RadGrid1_ItemEvent</span>(<span style="color: #333399; font-weight: bold">object</span> sender, GridItemEventArgs e)
{
<span style="color: #008800; font-weight: bold">if</span> (e.EventInfo <span style="color: #008800; font-weight: bold">is</span> GridInitializePagerItem)
{
totalItemCount = (e.EventInfo <span style="color: #008800; font-weight: bold">as</span> GridInitializePagerItem).PagingManager.DataSourceCount;
}
}
<span style="color: #008800; font-weight: bold">protected</span> <span style="color: #008800; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">RadGrid1_ItemCreated</span>(<span style="color: #333399; font-weight: bold">object</span> sender, Telerik.Web.UI.GridItemEventArgs e)
{
<span style="color: #008800; font-weight: bold">if</span> (e.Item <span style="color: #008800; font-weight: bold">is</span> GridPagerItem)
{
GridPagerItem pagerItem = (GridPagerItem)e.Item;
RadComboBox PageSizeCombo = (RadComboBox)pagerItem.FindControl(<span style="background-color: #fff0f0">"PageSizeComboBox"</span>);
RadComboBoxItem item1 = <span style="color: #008800; font-weight: bold">new</span> RadComboBoxItem();
item1 = <span style="color: #008800; font-weight: bold">new</span> RadComboBoxItem(<span style="background-color: #fff0f0">"Show All"</span>, totalItemCount.ToString());
item1.Attributes.Add(<span style="background-color: #fff0f0">"ownerTableViewId"</span>, e.Item.OwnerTableView.ClientID);
PageSizeCombo.Items.Add(item1);
}
}
</pre></div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com5tag:blogger.com,1999:blog-8168372949663241132.post-47435655649290469172012-06-11T03:01:00.000-07:002012-06-13T12:08:38.139-07:00what is the difference between Response.Redirect and Response.RedirectPermanent?<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Response.Redirect</b><br />
If you use the Response.Redirect() to redirect from Page A to Page B, search engines will keep Page A in their index since the Response.Redirect() indicates a temporary redirect. In case the original page (Page A) no longer exists, and Page B should replace Page A.The Response.Redirect generates Response code as 302.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxO7R0qM4gS5nOosry18C7d0wHhIdZq-jpZGKBFG3w6B-F-szA-RYUfUb_h56rGG57JkMB7P5aUE1qGoHwPtWDJlwfb2OSeloKndPJvYnMwXC0KL_lJh-AjGheFe5wK7h4xAGmR018Xn0/s1600/Response.Redirect.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxO7R0qM4gS5nOosry18C7d0wHhIdZq-jpZGKBFG3w6B-F-szA-RYUfUb_h56rGG57JkMB7P5aUE1qGoHwPtWDJlwfb2OSeloKndPJvYnMwXC0KL_lJh-AjGheFe5wK7h4xAGmR018Xn0/s320/Response.Redirect.png" width="320" /></a></div>
<br />
<br />
<b>Response.RedirectPermanent</b><br />
While in Response.RedirectPermanent to redirect from Page A to Page B, search engines will keep Page B in their index since the Response.RedirectPermanent() indicates a permanant redirect.The Response.RedirectParmanent generates Response code as 301.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH6TYj0PzlQjvLgVmwJ-rl8pgA4QQwKaP6421LprLiuPiZiphxlBigqT2zMTSledbOXJDFArWQiVzm64AupEi7330uNM7E353r0I_Hy9TGbqD517wXiqai1iJLkXGns5ARrGHh5nxw93g/s1600/Response.RedirectPermanent.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH6TYj0PzlQjvLgVmwJ-rl8pgA4QQwKaP6421LprLiuPiZiphxlBigqT2zMTSledbOXJDFArWQiVzm64AupEi7330uNM7E353r0I_Hy9TGbqD517wXiqai1iJLkXGns5ARrGHh5nxw93g/s320/Response.RedirectPermanent.png" width="320" /></a></div>
<br />
What is the difference between permanent and temporary redirect?<br />
<br />
<span style="font-weight: bold;">Permanent 301 </span><br /> To
summarize in a few lines, permanent 301 redirects are just as they
sound. They are permanent redirects from an old URL to a new one. These
redirects tell the search engines that the old location is to be removed
from their index and replaced with the new location. Using 301
redirects is the most search engine friendly way to redirect traffic and
engines, and far out weighs that of various JavaScript and Meta refresh
redirects.<br />
<br />
<span style="font-weight: bold;">Temporary 302</span><br />
Temporary 302 redirects are also as they sound; temporary. Here you are
telling the search engines to read and use the content on the new page,
but to keep checking the original URL first as it will ultimately be
reestablished.<br />
<br />
So, main deference between Response.Redirect() and Response.RedirectPermanent() is related to SEO.<br />
<div style="background-color: white; border: medium none; color: black; overflow: hidden; text-align: left; text-decoration: none;">
<br /></div>
</div>Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com2tag:blogger.com,1999:blog-8168372949663241132.post-75041622022505671152012-05-31T09:22:00.000-07:002012-07-06T06:14:44.242-07:00Telerik Webinar Week will be held June 18-22, 2012.<div dir="ltr" style="text-align: left;" trbidi="on">
The Q2 2012 Webinar Week is quickly approaching (as is our upcoming
major release)! As always, we are organizing this week-long event packed
with hour-long webinar sessions to walk you through all the awesome
things we’ve been working on during the past four months. If you’re
eager to be among the first to learn how the Q2 bits can enhance your
productivity,<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-KxE15kL4czo/T8eWmjKKO9I/AAAAAAAAAh0/SIQQ12mMjHs/s1600/Blog_banner_WebinarWeek.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="107" src="http://4.bp.blogspot.com/-KxE15kL4czo/T8eWmjKKO9I/AAAAAAAAAh0/SIQQ12mMjHs/s320/Blog_banner_WebinarWeek.jpg" width="500" /></a>
</div>
<a href="http://www.telerik.com/products/whats-new.aspx" target="_blank">Book your seat for Webinar Week now>></a><br />
Webinar Week will be held June 18-22, 2012. And you know the drill,
one lucky attendee at each webinar will win more than $2,000 worth of
software. This time around though, as a token of our appreciation for
being our customers, we have decided to also grant each Webinar Week
attendee with a discount code valid towards a next Telerik purchase,
upgrade or renewal! <br />
Our evangelists have prepared amazing things to show you, so be there! </div>Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com0tag:blogger.com,1999:blog-8168372949663241132.post-34965826272070891882012-05-19T06:07:00.000-07:002016-09-05T01:26:33.750-07:00How to access the control from itemtemplate in Radgrid on client side<div dir="ltr" style="text-align: left;" trbidi="on">
You get control from itemtemplate in Radgrid by below methods.
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #888888;">// Method1</span>
<span style="color: #008800; font-weight: bold;">var</span> ChkSelect <span style="color: #333333;">=</span> $(row.get_element()).find(<span style="background-color: #fff0f0;">"input[id*='ChkSelect']"</span>).get(<span style="color: #0000dd; font-weight: bold;">0</span>);
<span style="color: #888888;">// Method2</span>
<span style="color: #008800; font-weight: bold;">var</span> ChkSelect <span style="color: #333333;">=</span> $telerik.findControl(row.get_element(), <span style="background-color: #fff0f0;">"ChkSelect"</span>);
<span style="color: #888888;">// Method3</span>
<span style="color: #008800; font-weight: bold;">var</span> ChkSelect <span style="color: #333333;">=</span> row.findControl(<span style="background-color: #fff0f0;">"ChkSelect"</span>);
</pre>
</div>
For how to access row from radgrid check <a href="http://jayeshgoyani.blogspot.in/2011/11/access-radgrids-control-on-client.html"><b>this</b></a> link.
</div>
Jayesh Goyanihttp://www.blogger.com/profile/06613799088874140387noreply@blogger.com6