|
I have just started learning LINQ. i making DAL and i want DAL to return dataset like it used to be in .net 2.0. so that i can use data with any control. Or do need to do it with by running foreach loop? the code is like this
public IQueryable sel(int intCatID)
{
LINQPracticeDataContext db = new LINQPracticeDataContext();
var products = from p in db.MyProducts
where p.CategoryID == intCatID
orderby p.UnitPrice descending
select new { p.CategoryID, p.ProductName,p.UnitPrice };
return products;
}
|
|
|
|
|
Hie all,
I have got a small problem, im using the code below to close a page. It works only when its under a button(ie button click event) but when i use a toolbar click event its not closing the page, even though it runs through the code without any errors. does anyone know whats wrong.
protected void RadToolBar1_ButtonClick1(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
{
if ((e.Item.Text == "Save & Close")
{
string scriptString = "; window.close();
Page.ClientScript.RegisterClientScriptBlock(this.GetType()), "submitScript", scriptString);
}
}
|
|
|
|
|
That's a wrong implemenation that you are providing i think
omlac wrote: but when i use a toolbar click event
Register your script in PageLoad by using Button
RadToolBar1.Attributes.Add("onclick", "javascript:window.close();");
where RadToolBar1 is your button id on clicking of which the window should close ?
Sorry but which event are you talking about ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
Thanks
im doing everything in the radtoolbar clickevent, i have got a lot of other items on toobar, say "save" button and "save & Close" , so only when i click Save & close is when i want to close the page.
does the line RadToolBar1.Attributes.Add("onclick", "javascript:window.close();"); allow me to close only when button on toolbar is "save & close"
|
|
|
|
|
Yes,I supposed that "save & close" text is of RadToolBar1 button ?
Are you showing any pop up window which are having all this button ?
My code will close the window whenever user click RadToolBar1 button
Could you explain what are you trying to do ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
this radtoolbar is on a popup form. the toolbar has a number of items and i want to execute code depending on the item clicked on the toolbar.
|
|
|
|
|
Hi all,
I have requirement of capturing the opened webpage of my application.
In my webpage i am placing a button'btn_Capture' to capture the webpage.
If i click on button the whole web page should be converted into image(Except the btn_Capture).
Please suggest me how to achieve this.
Thanks inadvance,
|
|
|
|
|
|
Thanks metillica_rock10.
I will try those links.
|
|
|
|
|
I got the logic.
Here is logic i am pasting for others.
Code In VB.Net
==============
Imports Microsoft.VisualBasic
Imports System.Threading
Imports System.Drawing
Imports System.Windows.Forms
Private Class HtmlToImage
Private PageUrl As String
Private ConvertedImage As Bitmap
Private m_intHeight As Integer
Public Property Height() As Integer
Get
Return m_intHeight
End Get
Set(ByVal value As Integer)
m_intHeight = value
End Set
End Property
Private m_intWidth As Integer
Public Property Width() As Integer
Get
Return m_intWidth
End Get
Set(ByVal value As Integer)
m_intWidth = value
End Set
End Property
Public Function ConvertPage(ByVal PageUrl As String) As Bitmap
Me.PageUrl = PageUrl
Dim thrCurrent As New Thread(New ThreadStart(AddressOf CreateImage))
thrCurrent.SetApartmentState(ApartmentState.STA)
thrCurrent.Start()
thrCurrent.Join()
Return ConvertedImage
End Function
Private Sub CreateImage()
Dim BrowsePage As New WebBrowser()
BrowsePage.ScrollBarsEnabled = False
BrowsePage.Navigate(PageUrl)
AddHandler BrowsePage.DocumentCompleted, AddressOf WebBrowser_DocumentCompleted
While BrowsePage.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
End While
BrowsePage.Dispose()
End Sub
Private Sub WebBrowser_DocumentCompleted(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
Dim BrowsePage As WebBrowser = DirectCast(sender, WebBrowser)
BrowsePage.ClientSize = New Size(Width, Height)
BrowsePage.ScrollBarsEnabled = False
ConvertedImage = New Bitmap(Width, Height)
BrowsePage.BringToFront()
BrowsePage.DrawToBitmap(ConvertedImage, BrowsePage.Bounds)
End Sub
End Class
/////////////////////////////
In C#.Net
=========
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Drawing;
namespace HtmlToImage
{
class ImageFromHtml
{
private string PageUrl;
private Bitmap ConvertedImage;
private int m_intHeight;
public int Height
{
get { return m_intHeight; }
set { m_intHeight = value; }
}
private int m_intWidth;
public int Width
{
get { return m_intWidth; }
set { m_intWidth = value; }
}
public Bitmap ConvertPage(string PageUrl)
{
this.PageUrl = PageUrl;
//ThreadStart thrCur = new ThreadStart(new EventHandler(CreateImage));
Thread thrCurrent = new Thread(new ThreadStart(CreateImage));
thrCurrent.SetApartmentState(ApartmentState.STA);
thrCurrent.Start();
thrCurrent.Join();
//ConvertedImage.Save(@"D:\imges.jpg");
return ConvertedImage;
}
private void CreateImage()
{
WebBrowser BrowsePage = new WebBrowser();
BrowsePage.ScrollBarsEnabled = false;
BrowsePage.Navigate(PageUrl);
BrowsePage.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(WebBrowser_DocumentCompleted);
while (BrowsePage.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
BrowsePage.Dispose();
}
private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser BrowsePage = (WebBrowser)(sender);
BrowsePage.ClientSize = new Size(Width, Height);
BrowsePage.ScrollBarsEnabled = false;
ConvertedImage = new Bitmap(Width, Height);
BrowsePage.BringToFront();
BrowsePage.DrawToBitmap(ConvertedImage, BrowsePage.Bounds);
}
}
}
//////////////////////////////////////
Using the above Class from code behind.
In widows application:
======================
ImageFromHtml image = new ImageFromHtml();
image.Height = 800;
image.Width = 1020;
Bitmap img = image.ConvertPage("http://www.google.com");//Website name to capture
img.Save(@"D:\imge.jpg");// Save the image in D:\ directory
In Web Application:
===================
//Add the above class in your 'App_Code' direcory of project. Add reference of "System.Threading,System.Windows.Forms,System.Drawing"
//Or Its better to Create a Class Library project for above Class "ImageFromHtml". And add the .dll as reference to your website.
//Place a One button on Form
//In Button_Click Event Write the below code
ImageFromHtml image = new ImageFromHtml();
image.Height = 800;
image.Width = 1020;
Bitmap img = image.ConvertPage(Request.Url.ToString());//This is url of your application which is running.
img.Save(@"D:\imge.jpg"); //Saving image in D directory
Cheers,
sekhar
|
|
|
|
|
Hello friends
I want to deploy my application on linux server , I've heard about the mono on linux i will be thankful if some more information is provided
Thanks and regards
sindhu tiwari
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
Hi,
How can i capture windows Download dialog box events??
Eg, I m opening file download dialog box. Then I want to know what user do on that, means which button he press, "Save", "Open", "Cancel" or "Close".
How i know which event fires??
Please help in this regard.
Thanks in advance
|
|
|
|
|
my understanding of this process is that it uses a dialog internal to the browser running in its own thread, so there is no way to hook into it using javascript - or anything else served up from the web site.
please let me know if you discover differently!
|
|
|
|
|
hi
i have to create the checkbox list dynamically and add the selectedindexchanged event handler
and against that checked change new checkboxlist will be created
but i could not handle the event handler properly
if anyone can help
|
|
|
|
|
You can't, if you create a control dynamiclaly, unless you do it before page load, there will be no viewstate. Instead, you can check through the form data posted back for the id's of checkboxes that were checked.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
try this
name_of_your_checkbox.CheckedChanged+=new EventHandler(name_of_your_function);
|
|
|
|
|
As Christian suggest , he has to do this before page load !!!
cheers,
Abhijit
Think Sharp | Code Sharp | C Sharp
|
|
|
|
|
Hi I wanted to catch SqlExceptions --see the code below.
try
{
--- here code will produce TimeOut Exception (for testing pupose}
catch(SqlException ex)
{
throw ex;
}
catch(Exception e)
{
throw e;
}
when i am getting any TimeOut Exception,My code is not going into SqlException catch block,but
it is handled in general Exception.
because i want to display actual error (inner exception message)
|
|
|
|
|
Is the timeout a SQLException ? I assume it's some other type of exception and that the SQLException is for when your SQL is bad,.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi,
when i am seeing in Quickwatch.inner exception it is saying SQLEXception
and it has message :Request Timeout
Please suggest on this...
|
|
|
|
|
How can i Create Pagging with DataList same as the Google search engine Shows in the bottom when we search anything on that.
Pradeep Sharma
|
|
|
|
|
You may need to use a repeater to get that level of control over how it's rendered.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I would say you only can do that with a repeater or a custom control where you override the Render Method where you control everything.
If you are going to try the Repeater, try to use ITemplates classes for your repeater (those can inherit from HtmlTable and HtmlTableRow, the parentHeaderTemplate and the RowTemplate. You will see is much easier
Ricardo Casquete
|
|
|
|
|
|
You can turn off validation in javascript, I think you can specify your validators in a group and then make your control not be part of that group, or you can just render a vanilla link, so no validation occurs.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|