|
el_scrub wrote: Im starting to look at web programming
You should start with something a little less involved. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I though these would have been fairly basic questions !
Its seemed a basic enough chat tutorial !
|
|
|
|
|
Hello All,
I found the article on SearchableGridView to be most helpful because it functions exactly how my client wants it. I converted the C# code to VB and created a new class file in my web application, naming it SearchGridView.vb. I inserted the converted code, referenced the namespace in web.config and added an import namespace to my content page.
Unfortunately, I receive the following error:
Warning 1 Namespace or type specified in the project-level Imports 'MyApp.WebControls' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. DielWebProj
Here's the first bit of SearchGridView.vb:
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Drawing.Design
<Assembly: TagPrefix("MyApp.WebControls", "SearchGridView")>
Namespace MyApp.WebControls
#Region "TemplateColumn"
Public Class NumberColumn
Implements ITemplate
Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements System.Web.UI.ITemplate.InstantiateIn
End Sub
End Class
#End Region
<ToolboxData("<{0}:SearchGridView runat=server></{0}:SearchGridView>")> _
<ParseChildren(True, "SearchFilters")> _
Public Class SearchGridView
Inherits GridView
Can anyone identify where I've gone wrong? How do I rectify this issue?
Thanks,
Sid
|
|
|
|
|
Does anyone have an example of an AJAX.NET WEB Framework 3.5 service returning a DataTable object. I am having a problem with the proxy returning the correct value from the server. A woorking example would be a big help Thanks
|
|
|
|
|
Is Google broken? I know the language. I've read a book. - _Madmatt
|
|
|
|
|
No, I've checked this for you
Google Replied: Results 1 - 10 of about 10,700,000 for ajax examples. (0.27 seconds)
Antoine de Saint-Exupery: Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
|
|
|
|
|
Of course Goolge isn't broken, I was directing it at the OP ID 10 T I know the language. I've read a book. - _Madmatt
|
|
|
|
|
It was, in fact a joke (hence the smiley), reinforcing the fact he hadn't even bothered to google.... Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
hi, Im going to resolve requested url, and catch related query string (request) from url
for example when client try to redirect to www.mysite.com/myname, it change to www.mysite.com/?page=myname
exactly no page exist named myname
Response.Request["page"] return Query String i know , but the url must be formatted struct.modified on Saturday, February 13, 2010 6:32 PM
|
|
|
|
|
Could you please elaborate what exactly you are looking for?
|
|
|
|
|
|
|
Thanks a lot, i really need this.
|
|
|
|
|
<asp:EntityDataSource ID="srcCity" runat="server" ContextTypeName="Namespace.Core.Tracking.Domain" EntitySetName="Cities"
EntityTypeFilter="City" Include="Country" AutoGenerateWhereClause="true"/>
<WhereParameters/>
<asp:QueryStringParameter Name="Country.ID" Type="Int32"
QueryStringField="CountryID" />
</WhereParameters>
</asp:EntityDataSource>
<asp:EntityDataSource ID="srcCountry" runat="server" ContextTypeName="Namespace.Core.Tracking.Domain"
EntitySetName="Countries" EntityTypeFilter="Country" OrderBy="it.Name"/>
<asp:GridView ID="grid" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="srcCity">
<MasterTableView DataSourceID="srcCity" EditMode="InPlace">
<asp:TemplateField>
<asp:Label ID="lblName" runat="server"
Text='<%# Eval("Country.Name") %>'/>
</asp:TemplateField>
<EditItemTemplate>
<asp:DropDownList ID="lstCountry" runat="server"
SelectedValue='<%# Eval("ID") %>'DataSourceID="srcCountry"
DataTextField="Name" DataValueField="ID"
AppendDataBoundItems="true">
<ListItems>
<asp:ListItem Text="" Value="" />
</ListItems>
</DropDownList>
</EditItemTemplate>
</MasterTableView>
</GridView>
public partial class City : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){
grid.RowCreated += new GridViewRowEventHandler(grid_RowCreated);
}
void grid_RowCreated(object sender, GridViewRowEventArgs e){
if (e.Row.DataItem != null){
var city = EntityDataSourceExtensions.GetItemObject<City>(e.Row.DataItem);
if(city.Country != null)
(grid.FindControl("lstCountry")as DropDownList).SelectedValue = city.Country.ID.ToString(); <-- Here I got Exception
}
}
}
public static class EntityDataSourceExtensions {
public static TEntity GetItemObject<TEntity>(object dataItem) where TEntity : class {
var entity = dataItem as TEntity;
if(entity != null)
return entity;
var td = dataItem as System.ComponentModel.ICustomTypeDescriptor;
if(td != null)
return (TEntity)td.GetPropertyOwner(null);
return null;
}
}
C# Developer-- Modified Sunday, February 14, 2010 3:22 AM
modified on Sunday, February 14, 2010 3:39 AM
|
|
|
|
|
Please apply proper formating for your code before posting.
Developers generally hate to see the code without proper formatting and hence
your post might be ignored by a lot of members.
|
|
|
|
|
OK,ok, I've done it...
but nobody wantede help
C# Developer
|
|
|
|
|
Hi, I have a problem similar to this post:
http://www.microsoft.com.nsatc.net/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.office.developer.vba&tid=6fc07fd9-3313-4c09-9457-f6971ecafda4&cat=en_US_9477b478-d551-48fe-b931-e0d7ed05ac44&lang=en&cr=US&sloc=&p=1
In this post the original poster has written his code in VB whereas I have written my code in C#
My code for uploading a file:
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.PostedFile.ContentLength>0)
{
string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
string storagepath = "D:\\Test\\" + filename;
int contentLen = FileUpload1.PostedFile.ContentLength;
Byte[] data = new Byte[contentLen];
FileUpload1.PostedFile.InputStream.Read(data, 0, contentLen);
savefiletodatabase(data);
FileUpload1.SaveAs(storagepath);
}
}
private void savefiletodatabase(byte[] data)
{
SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
try
{
SqlCommand command = new SqlCommand("INSERT into dbo.test ([file], [filename], [path]) VALUES (@data, '" + FileName + "', '" + FilePath + "')", connection);
command.Parameters.AddWithValue("data", data);
connection.Open();
command.Connection = connection;
command.ExecuteNonQuery();
}
catch (Exception ex)
{
throw ex;
}
finally { connection.Close(); }
}
The code to retrieve file goes here:
protected void LinkButton1_Click(object sender, EventArgs e)
{
getfile();
}
private void getfile()
{
SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
try
{
SqlCommand command = new SqlCommand("Select [file] FROM dbo.test where id='" + Id + "'", connection);
SqlDataReader reader;
connection.Open();
command.Connection = connection;
reader = command.ExecuteReader();
if (reader.Read())
{
byte[] data = (byte[])reader[0];
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;filename=" + TextBox2.Text);
Context.Response.BinaryWrite(data);
}
}
catch (Exception ex)
{ throw ex; }
finally
{
connection.Close();
}
}
I am giving You the table structure here:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[test](
[file] [varbinary](max) NULL,
[filename] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[path] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[id] [int] IDENTITY(1,1) NOT NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
please help me out;
also when I uploaded a file to the database it was of 18041 bytes, but when I retrieved it after saving on desktop the size was 19,756 bytes which is increased?Thanks
Shankbond
|
|
|
|
|
shankbond wrote: also when I uploaded a file to the database it was of 18041 bytes, but when I retrieved it after saving on desktop the size was 19,756 bytes which is increased?
I think you need to clear the response using Response.Clear()
It's very important not to use string concatenation to make sql statements. Use parameterized queries instead.
|
|
|
|
|
Hi,
hspc wrote: I think you need to clear the response using Response.Clear()
I did but it does no effect on the size.Thanks
Shankbond
|
|
|
|
|
how to embed a 3rd party vedio conferencing software in asp.netcode?
is it possible in .net3.5?
can anybody suggest me any 3rd party tool for vedio conferencing?
plz its very urgent........
|
|
|
|
|
Which Third party control do you want to embed ?
|
|
|
|
|
any best video conference tool..........
what i need is that user can use that vedio conference from website.
|
|
|
|
|
|
hi,
When i change source of page then designer appears empty as a blank page that no control added to, so i can't change any source ...
thnaks in advance
|
|
|
|
|
right click on page and select convert to webapplication. it will regerate your designer page
Regards
Keyur Satyadev
|
|
|
|