|
I guess I can let the user know what the problem was?
Thanks
|
|
|
|
|
Why not?
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Well... you can use Javascript to at least check the file extension - this doesn't guarantee the file is valid, of course, but it will help eliminate some innocent errors....
If you have a file input box on your form
<input id="file1" type="file" onchange="checkFile(this)" name="file1">
You can use the following function - change the line
var fileTypes=["gif","jpg","jpeg"];
to suit whatever file extensions you want to check for.
function checkFile(what){
var source=what.value;
var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
// valid file types
var fileTypes=["gif","jpg","jpeg"];
for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
if (i==fileTypes.length) {
alert("THAT IS NOT A VALID FILE\nYou can only uload files with the following extensions:\n\n"+fileTypes.join(", "));
}
}
// -->
</script>
This script was adapted from one I downloaded from
The JavaScript Source!! http://javascript.internet.com
and the original was created by Abraham Joffe : http://www.abrahamjoffe.com.au/
They would probably appreciate your adding such comments to this script if you use it on a web-page.
cheers
Phil
-- modified at 4:26 Wednesday 26th April, 2006
|
|
|
|
|
Hi there,
Do you mean that you have to read the file's content to validate at client-side before uploading? if so, you upload file to server and validate at server-side. You dont have permission to read file at client
<< >>
|
|
|
|
|
|
|
For Print
1. window.print()
THis will print whole page
2. Give Link Print on click of which it will open IE popup using window.open()
which only contains grid control having same result and in that popup give print button on click of which it will print whatever there in the popup means as per our logic only grid with result.
You can hide print button using document.form.btnPrint.style.visiblity = hidden
OR
objBtn = document.getElementById(btnPrint)
objBtn.style.display = 'none'
|
|
|
|
|
hi
Ihave uninstall Microsoft IE WebControls and install ComponentArt still i didnt get any license key and performed a small program while compiling i get the following error
componentart_webui_client/2006_1_1208/A573G988.js not found
I am trying to search but in vain what exaclty this js file is .Can anyone who has worked with ComponentArt can explain me what went wrong.
When I can get the key I am using this coponent as trial basis .Please Guide me
thanks in advance
sasi
|
|
|
|
|
|
hai everyone
i m ajay.
i m facing a problem related to creating a textbox in template column of a datagrid at runtime.i am giving my code snippet.although when i m taking a label instead of textbox it works fine.but when i m dealing with a textbox it gives me the error
"Control '_ctl0__ctl2_lbl1' of type 'TextBox' must be placed inside a form tag with runat=server."
my coding is------
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.SqlClient
Public Class WebForm1
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Template()
End Sub
Private Sub Template()
Dim DataGrid1 As New DataGrid
DataGrid1.AutoGenerateColumns = False
DataGrid1.GridLines = GridLines.Both
DataGrid1.BackColor = Color.Pink
DataGrid1.BorderWidth = Unit.Pixel(2)
DataGrid1.BorderColor = Color.Blue
DataGrid1.HeaderStyle.BackColor = Color.Yellow
DataGrid1.HeaderStyle.ForeColor = Color.Brown
DataGrid1.HeaderStyle.Font.Bold = True
DataGrid1.CellPadding = 10
Dim Field1 As String
Dim Field2 As String
Dim Header1 As String
Dim Header2 As String
Field1 = "name"
Field2 = "description"
Header1 = "Name"
Header2 = "Description"
Dim tempcol As New TemplateColumn
'Dim tbc As New MyTemp(ListItemType.Item, Field1, Field2)
'tempcol.ItemTemplate = tbc
' Header Template
tempcol.HeaderTemplate = New MyTemp(ListItemType.Header, Header1, Header2)
' Item Template
tempcol.ItemTemplate = New MyTemp(ListItemType.Item, Field1, Field2)
' Add Template into Grid
DataGrid1.Columns.Add(tempcol)
' Binding Data Source
Dim cnn As New SqlConnection("")
Dim da As New SqlDataAdapter("")
Dim ds As New DataSet
da.Fill()
DataGrid1.DataSource = ds
DataGrid1.DataMember = ""
DataGrid1.DataBind()
' Bind Grid into Label
' Me.lblShowGrid.Controls.Add(DataGrid1)
Page.Controls.Add(DataGrid1)
End Sub
End Class
Public Class MyTemp
Implements ITemplate
Dim TemplateType As ListItemType
Dim Field1 As String
Dim Field2 As String
Sub New(ByVal type As ListItemType, ByVal fld1 As String, ByVal fld2 As String)
TemplateType = type
Field1 = fld1
Field2 = fld2
End Sub
Sub InstantiateIn(ByVal Container As Control) Implements ITemplate.InstantiateIn
'Dim lbl1 As New WebControls.TextBox
Dim lbl1 As New TextBox
lbl1.BackColor = Color.Beige
Dim lbl2 As Label = New Label
Dim lc1 As LiteralControl = New LiteralControl
Dim lc2 As LiteralControl = New LiteralControl
Select Case TemplateType
Case ListItemType.Header
lc1.ID = "textbox1"
lc1.Text = Field1
Container.Controls.Add(lc1)
lc2.ID = "lc2"
lc2.Text = Field2
Container.Controls.Add(lc2)
Case ListItemType.Item
lbl1.ID = "lbl1"
AddHandler lbl1.DataBinding, AddressOf BindIntegerColumn
Container.Controls.Add(lbl1)
lbl2.ID = "lbl2"
AddHandler lbl2.DataBinding, AddressOf BindStringColumn
Container.Controls.Add(lbl2)
End Select
End Sub
Sub BindIntegerColumn(ByVal Sender As Object, ByVal e As EventArgs)
Dim lbl1 As New TextBox
lbl1 = CType(Sender, TextBox)
Dim Container As DataGridItem = CType(lbl1.NamingContainer, DataGridItem)
lbl1.Text = DataBinder.Eval(Container.DataItem, Field1)
End Sub
Sub BindStringColumn(ByVal sender As Object, ByVal e As EventArgs)
Dim lbl2 As Label = CType(sender, Label)
Dim Container As DataGridItem = CType(lbl2.NamingContainer, DataGridItem)
lbl2.Text = DataBinder.Eval(Container.DataItem, Field2)
End Sub
End Class
thanx in advance
any suggetion will be highly appriciated
ajay
|
|
|
|
|
Me.lblShowGrid.Controls.Add(DataGrid1)
Page.Controls.Add(DataGrid1)
Because you add the grid control to the Page, so the grid and its child controls inluding the textbox will be placed outside the form element, and you will get the error. Instead, you should get reference to the form element, and add the grid to the Controls collection of the form. Another option is to place a container like Panel or PlaceHolder control in the form, and add the grid to this container.
|
|
|
|
|
I used Google Web Service to do web search, and I have already succeed to use Google Web API to do that in the same web page. But my problem is that how does the search result returned and open a new web page to show these records.
Please give me some guide. I will appreciate your teaching. Thank you.
HI!
volunteer0706@yahoo.com.tw
|
|
|
|
|
There are two options come to mind:
+ You open the new page and pass the search parameter to this page, the new page is responsible for calling the search APIs and displaying the result.
+ You use the current page to call the search APIs, then persist the result somewhere for example in the Session, and open the new page. The new page should be able to access the persisted result so that it can display on the web page.
Just some ideas.
|
|
|
|
|
Hi..
I have visual studio 2003 and I am trying to use Google Search Web Service(C#).But I got the error:
DataBinder.Eval: 'EProjects.googleapi.ResultElement' does not contain a property with the name title.
The source code of the Web Form that should display the Google Search Results:
using googleapi;
/// <summary>
/// Summary description for GoogleResults.
/// </summary>
public class GoogleResults : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.ImageButton imgPrev;
protected System.Web.UI.WebControls.ImageButton imgNext;
protected System.Web.UI.WebControls.DataList lGoogle;
public EProjects.googleapi.GoogleSearchResult gsR;
public EProjects.googleapi.GoogleSearchService gcs;
private void Page_Load(object sender, System.EventArgs e)
{
gcs=new googleapi.GoogleSearchService();
gsR=gcs.doGoogleSearch(licenceKeyString,Request.QueryString["Query"],
0, 1,true, "", true, "", "", "");
PopulatelGoogle(gsR);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
///Required method for Designer support - do not modify
///the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void PopulatelGoogle(GoogleSearchResult gsR)
{
lGoogle.DataSource=gsR.resultElements;
lGoogle.DataBind();
}
}
}
The HTML code of the same page:
<table height="100%" width="100%">
<tr>
<td colSpan="2">
<asp:datalist id="lGoogle" runat="server">
<ItemTemplate>
<span style="font-size:17px;font-weight:bold;">
<%#DataBinder.Eval(Container.DataItem,"title")%>
</span></br>
<%#DataBinder.Eval(Container.DataItem,"snipper")%>
</br> <a href='<%#DataBinder.Eval(Container.DataItem,"URL")%>'>
<%#DataBinder.Eval(Container.DataItem,"URL")%>
</a>
</ItemTemplate>
<SeparatorTemplate>
</p>
</SeparatorTemplate>
</asp:datalist></td>
</tr>
<tr>
<td align="left"><asp:imagebutton id="imgPrev" Runat="server"></asp:imagebutton></td>
<td align="right"><asp:imagebutton id="imgNext" Runat="server"></asp:imagebutton></td>
</tr>
</table>
I tried to solve this problem for a long time but I couldnt please help.
I am too late but i will never give up
|
|
|
|
|
hi
can anybody tell the difference between configSource and file attributes in web.config file
coolsweety
|
|
|
|
|
+ The file attribute specifies an external file containing custom settings like you do in the appSettings entry of the web.config file. Meanwhile, the external file specified in the configSource attribute contains the settings for the section which you declare the configSource for. For example, if you use the configSource attribute of the pages section, then the external file will contain the settings for the pages section.
+ The custom settings declared in the external config specifified in the file attribute will be merged with the settings in the appSettings section in the web.config file. In the meanwhile, the configSource does not support merging, it means that you'll have to move the entire section settings into the external file.
|
|
|
|
|
thanx very much
coolsweety
|
|
|
|
|
Can i possible to put an infragistics control inside ajax panel
give ur suggesstions with source
-
|
|
|
|
|
What is a infragistic control?
And a please would be nice
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
hi for all
i need to know how debug in aspx javascript and see what happend in the code javascript
i tryn some advice form internet but it dosent work
someone with some tick
thanks
|
|
|
|
|
|
hi
thanks for the time
i wish clean my command window i dont know to do >cls in my command window
but from this signal > i can write cls and it clean my command window
i konw how i exit from > for can type ?variable
can say me the command to can to go > and can exit from it
thanks for all
|
|
|
|
|
Tne > character is used as prompt by a lot of console tools. It would help if you could mention what it is that you are doing.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I have been implenting a processing page as per this article http://www.codeproject.com/aspnet/AsyncProcessingMessage.asp where I show a processing page and then go on to some other page as needed. My problem is that I want to go back to the original page that called the processing page but when I do this it thinks it is a new page and the IsPostBack is false.
This means that I loose the state of the page including the error message that I would like shown and I must go back to the original page to allow the user to make some changes.
Any ideas?
|
|
|
|
|
Of course it thinks that it is a new page. It is.
If you have anything in ViewState, that is already lost when you leave the page. If you wan't to retain any information, you would have to actually send it along from page to page.
Web pages are stateless by nature, meaning that they are not aware of previous pages, only the information that is actually sent to the page. Every request is a completely new page from scratch, even a postback.
---
b { font-weight: normal; }
|
|
|
|