|
Hi,
i set in the web.config file the user can upload upto 10mb file. but when i tried to test it with more than 10mb and press that upload button, it is not even going to that event and directly showing error in the browser. How can i handle this exception?
Santhapur
|
|
|
|
|
Instead of specifying the maximum filesize in Web.config, check the uploaded file length during your upload event. You can invalidate the control or display an error message if they exceed the maximum filesize.
|
|
|
|
|
thats what my question is .. its not even triggering the upload event .. its directly displaying error... if it triggers the upload button event i can check and do as u said ...
|
|
|
|
|
Hi all,
I have a DetailsView and GridView on one site. The DetailsView contains some TemplateItems with different validators like RequiredFieldValidator or RegularExpressionValidator .
Example:
<asp:detailsview id="DetailsViewInsertUser" runat="server" autogeneraterows="False" xmlns:asp="#unknown">
DataKeyNames="Id" DataSourceID="myDSObj" DefaultMode="Insert"
Caption="Add user" CaptionAlign="Left">
<Fields>
<asp:templatefield headertext="Titel" sortexpression="Titel">
<EditItemTemplate>
<asp:textbox id="TitelTextBox" runat="server" text="<%# Bind("Titel") %>"></asp:textbox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:textbox id="TitelTextBox" runat="server" text="<%# Bind("Titel") %>"></asp:textbox>
<asp:requiredfieldvalidator id="TitelTextBoxRequiredFieldValidator" runat="server">
ControlToValidate="TitelTextBox" ErrorMessage="Error!"
Display="Dynamic">
</asp:RequiredFieldValidator>
</InsertItemTemplate>
<ItemTemplate>
<asp:label id="Label1" runat="server" text="<%# Bind("Titel") %>"></asp:label>
</ItemTemplate>
</asp:TemplateField>
...
</asp:requiredfieldvalidator></asp:templatefield></asp:detailsview>
When I want to edit entries of the GridView and confirm those with an Update HTML Button in the view, the event won't be completed cause the validators block them. So far it's all right.
Now I tried to disable those validation controls via the Enable Attribute of them, but I don't know how iI can access this control via my DetailsViewInsertUser object.
Example:
protected void UserGridView_OnRowEditing(object sender, EventArgs e)
{ ((RegularExpressionValidator)UserGridView.Controls.FindControl("EMailTextBoxRegexValidator")).Enabled = false; }
Does somebody know how it works?
Cheers
Jerry
|
|
|
|
|
I got it!
((RegularExpressionValidator)DetailsViewInsertUser.Controls[0].FindControl("EMailTextBoxRegexValidator")).Enabled = false;
|
|
|
|
|
Hi all,
I have been struggling to get this done but it has drilled a nail in my head.
I have a grid as foll:
<asp:GridView ID="Grid_Results" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="loc" HeaderText="supplocid" SortExpression="loc" />
<asp:BoundField DataField="to_loc_ID" HeaderText="destlocid" SortExpression="destlocid" />
<asp:BoundField DataField="frm_loc" HeaderText="Source" SortExpression="frm_loc" />
<asp:BoundField DataField="to_loc" HeaderText="Destination" SortExpression="to_loc" />
<asp:BoundField DataField="amt_with_tax" HeaderText="Value(with Tax)" SortExpression="amt_with_tax"
DataFormatString="{0:f}" HtmlEncode="False">
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField DataField="amt_wo_tax" HeaderText="Value(without Tax)" SortExpression="amt_wo_tax"
DataFormatString="{0:f}" HtmlEncode="False">
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField DataField="totcld" HeaderText="Total CLD`s" SortExpression="totcld" />
<asp:BoundField DataField="freight" HeaderText="Freight" SortExpression="freight" />
</Columns>
<EmptyDataTemplate>
<asp:Label runat="server" ID="EDL" Text="Sorry!!! No Records found"></asp:Label>
</EmptyDataTemplate>
<RowStyle CssClass="datagrid_row1" />
<HeaderStyle CssClass="datagrid_heading" />
</asp:GridView>
and
the code i m using is as follows
Protected Sub Button_Search_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_Search.Click
Dim cmd As New SqlCommand()
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Blah Blah"
Dim loc As String = Nothing
If DDL_Location.SelectedValue <> "0" Then
loc = DDL_Location.SelectedValue
End If
frmdate = DateTime.ParseExact(TextBox_Date_From.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.CurrentCulture)
todate = DateTime.ParseExact(TextBox_Date_To.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.CurrentCulture)
cmd.Parameters.Add(New SqlParameter("@Fromdate", frmdate))
cmd.Parameters.Add(New SqlParameter("@todate", todate))
cmd.Parameters.Add(New SqlParameter("@source_loc", loc))
sda = New SqlDataAdapter
sda.SelectCommand = cmd
ds = New DataSet
sda.Fill(ds)
If ds.Tables(0).Rows.Count > 0 Then
Dim caption As String = ""
caption = "From date: " + frmdate.ToLongDateString + " To date: " + todate.ToLongDateString
Grid_Results.Caption = "<b>" + caption + "</b>"
Else
Grid_Results.Caption = String.Empty
End If
Grid_Results.DataSource = ds
Grid_Results.DataBind()
If ds.Tables(0).Rows.Count > 0 Then
Button_Export.Visible = True
Button_Export_All.Visible = True
Else
Button_Export.Visible = False
Button_Export_All.Visible = False
End If
End Sub
can anyone get this code working!!!!!
When you fail to plan, you are planning to fail.
|
|
|
|
|
www.Developerof.NET wrote: can anyone get this code working!!!!!
What is the problem? Did you try to debug it? what is the error ?
|
|
|
|
|
The prob is that the Empty data template is not showing. Nothing is displayed. Its all blank.
When i viewed the html source the grid renders as follows
<table cellspacing="0" rules="all" border="1" id="Grid_Results" style="border-collapse:collapse;">
<tr>
</tr>
</table>
ie
no text between the TR`s
no TD`s
When you fail to plan, you are planning to fail.
|
|
|
|
|
Hi
I'm writing a web app to upload up to 4 images to a folder. I also have a drop-down list so the user can choose whether pic is picture 1, 2, 3 or 4 (to set order on page display). Anyway, when one picture is uploaded the user stays in the form to add more pictures. I clear the DDL and re-populate it depending on which pictures have already been uploaded - i.e if pic 1 has been uploaded, only pic 2, 3 and 4 appear in drop-down. To determine this I use File.Exists but this doesn't seem to be working on a postback (i.e it doesn't find pic1.jpg which I have uploaded. It works however, if I leave the page and then click to add an image later - could this be an issue of the folder not refreshing so it looks like the file doesn't exist or a postback problem? Any ideas would be greatly appreciated.
Thanks
Lorna
|
|
|
|
|
You can use some variable in which you can store which images are properly uploded accordingly repopulate the dropdown
Cheers!!
Brij
|
|
|
|
|
hi,
i have 2 servers say "s1" and "s2"
in server "s1" i m maintaining the total website
and in server "s2" i have sqlserver database and 3rd party software
now from a page say Default.aspx located in server "s1" i want to create a object/run the 3rd party software in "s2".
is it possible,
plz help me
thanks in advance
lavan kumar M
|
|
|
|
|
Third party software should provide you eiter .dll or webservices . If that is dll, then
1. )Add it as a reference in your project,
2.) Add the Requried Namespace
3. ) Create object of classes and access methods
and if that is webservices , then add it as WebReference.
|
|
|
|
|
Do as Abhijit is saying but use Namespace properly
Cheers!!
Brij
|
|
|
|
|
Have you not been asking this for days ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have the need to load an aspx page that has server controls on it, into an existing element on another page. The server controls are compiled into a dll and contain embedded javascript, css and image files that are needed for the controls to work and look correct.
In a nutshell I want to load a page into a variable, access it's rendered HTML and apply that HTML into the innerHTML of an existing <div> or <asp:panel>, retaining any enbedded scripts, styles and images loaded.
Is this possible and if so, can anyone provide me with an example?
Or am I going about this in the wrong way?
Is there an easier way to load an aspx page into an existing element?
Really quite stuck and sick of googling...
Andy
|
|
|
|
|
Do you want the rendered html code in a server side variable? if yes then why u need it?
Cheers!!
Brij
|
|
|
|
|
yes, that's what I think I need, but am not sure if that'd be enough...
My main site consists of a master page (page.master) and one child page (exec.aspx). The content of exec.aspx is generated dynamically using code behind and custom wrote server controls, depending on where the user has navigated to via menus, links or events. All this is done ajax style so I'm avoiding any and all page reloads...
I have a need to include easy to write static pages that can be modified outside of the main code (by another developer), which would at some point be loaded dynamically and displayed to the user with the existing site layout.
Thnx
Andy
|
|
|
|
|
DuelMonster_Coder wrote: I have a need to include easy to write static pages that can be modified outside of the main code (by another developer), which would at some point be loaded dynamically and displayed to the user with the existing site layout.
Not clear about this part !!
|
|
|
|
|
A static page would consist of just a bit of text, an image or two, or a collection of information contained within a multi-panel accordion style server control.
I need this compiled into it's resulting HTML and entered into an existing element on the currently loaded page.
Thnx
Andy
|
|
|
|
|
Your question is not clear..
G. Satish
|
|
|
|
|
Would an iframe do the job for you?
|
|
|
|
|
Possibly...
I think I know the basic concept of an iframe, but I've never looked into using one before.
I seem to have a note in my head that they are a bad thing, but don't remember where that came from...
----------
Edit...
----------
I've just tried this and it's close to what I want, but the page I'm going to be loading doesn't know about the main sites css and won't ever.
So the resulting page loaded into the iframe doesn't match the main site style and I need it to.
Thnx
Andy
modified on Monday, December 8, 2008 9:08 AM
|
|
|
|
|
You want to look at writing a custom VirtualPathProvider and|or HttpHandler (this is what i did when faced with similar problem).
[EDIT] To be more clear, i also had to rework the way i modelled the system, i used a master page as the wrapper and the 'generated' pages used it as their master. The master can also be generated.
[/EDIT]
Or, load the custom page, compile it in code behind (i've never done this), then insert compiled code in existing div ... ok, this is what you said you want to do, sorry.
What does the url look like to distinguish between the various embedded pages ?
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
hello to every one,
kavita here. i am developing a website with some filed and check boxs. this i want a code in VB.Net or C#.Net to convert web page/iframe or anything like some space of webpage sholud be converted to pdf.
becuse i have to send this pdf to other member and again he will check the check boxs this works like in cycle. so please help in the loggic as well as code.and i have to fininsh this within 5 days. please tell me soon
thanks in advance.
kavita
Email:kavitachawoor@indiatimes.com
|
|
|
|
|
You have 5 days in which to either write or buy a PDF library, I guess. I would say that writing one is almost certainly not going to happen.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|