|
hi i am makling a custom validation for my textbox
however the format i need for the validation is:
#=number
@ = alphebate
@#######@
and i am using asp.net2 with c#
any one got any ideas on how to do this as i am having thouble validating that the first index of the input is an alphebate >.<
|
|
|
|
|
Hi Friends,
I am trying to read file info using following code.
When i run it on my local machine it works 100% but when I upload it to hosting server it throws exception!! or in other words it goes to else all the time
can any one hlep me why?
string fileOpenPath =this.FileUpload1.FileName.ToString();
FileInfo fi = new FileInfo(fileOpenPath);
//Ceck if file file exists
if (fi.Exists )
{
//do some work
}
else
{
//show message
}
|
|
|
|
|
That's because the file doesn't exist on the server. You can't use a file path that references a file on the client computer to access a file on the server.
When you are running it on your own computer, the client and the server is the same, so the file that exists on the client also exists on the server.
---
single minded; short sighted; long gone;
|
|
|
|
|
Could you please help me how can i do that then. some Code please
|
|
|
|
|
The FileUpload object contains the data from the uploaded file. Get the data from there, and if you need it as a file, create a file and write the data to it.
---
single minded; short sighted; long gone;
|
|
|
|
|
|
i am trying to incorporate a captcha in my project to prevent automated registrations. for the same downloaded various third party controls..
the prtoblem is that when ever i drag adn drop the captcha control, no image is shown.
though wen i run the original code file, it works perfectly fine.
i have even copoied the DLL in the BIN folder, created a new item in the toolbox. everytime the problem is of the image that is npt created.
can nyone tell me where i am going wrong.
Kunal
|
|
|
|
|
Hi all,
how to send parameters in sql statement using data adapter.
Ex: select * from emp where eno=2
here eno=2 is given dynamically through textbox in a webform.how can insert parameter values to that sql statement.
|
|
|
|
|
select * from emp where eno= '"+Textbox1.Text+"
Kunal
|
|
|
|
|
Thanks kunal,it is working
have a nice day
|
|
|
|
|
Look for SqlParameter and SqlCommand .
Mazy
"This chancy chancy chancy world."
|
|
|
|
|
Hi, i would like to know the difference between Response.Redirect() and server.Transfer() and in which situation what to use.
thanx, yamini
|
|
|
|
|
hi,
1.Server.Transfer acts as an efficient replacement for the Response.Redirect method.
2.Response.Redirect specifies to the browser to request a different page. Because a redirect forces a new page request, the browser makes two requests to the Web server, so the Web server handles an extra request.
3. Server.Transfer, which transfers execution to a different ASP page on the server. This avoids the extra request, resulting in better overall system performance, as well as a better user experience.
|
|
|
|
|
thanx and can u please tel me the situations where these particularly used.
|
|
|
|
|
Hi, I have page1 and page2. Now i want to access the controls of page1 in page2. How is this possible. Plz answer....
Thanx, Yamini
|
|
|
|
|
whenever you add a control to a specific page the access specifier for that control would be protected, so try changing the access specifiers of the controls in the class of your page1 !!!!
What is the exact requirement though?
Gautham
|
|
|
|
|
Hi Yamini,
It is not possible to access the controls of one page in to other page.
but you can have the values of the controls of one page into other page by using various state management techiniques like SessionState and QueryString.
If you want get the vaules of all the controls from the first page into the second page you can do it by the following way.
The following is the code in my Default.aspx.
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="T">Tea</asp:ListItem>
<asp:ListItem Value="C">Coffee</asp:ListItem>
<asp:ListItem Value="W">Wheat</asp:ListItem>
<asp:ListItem Value="CH">Chilli</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
The following is the Code written in Button1_Click
Server.Transfer("MyPage.aspx", true);
------------------------------------------------------------------------
Now in the Load event of MyPage.aspx I can get the value of the drowdown list of Default.aspx page as following.
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Request.Form["DropDownList1"].ToString());
}
This way you can get value of any of the contrls of the previous form.
----------------------------------------------------------------------
Caution : to make this thing working you need to put EnableViewStateMac="false" in the @Page directive of first aspx page whose control values you want to access.
I hope this will solve your issue.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Thanx. I tried this i got only one value i.e, the very first value in the dropdownlist...I didnt get other two. How to get other two values.
yamini
|
|
|
|
|
Hi,
Yes. This will give you the selected or entered values of the controls on the form. I wont give you the other option or items.
I think there is no way to achieve what you want to because as soon as a request goes to the server the previous page gets destroyed and each time a new fresh page comes to the browser that to in HTML format.
You could achieve this in windows application but I think its not possible in web application.
Can you tell me your exact requirement so that I can suggest u alternative.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Hi there,
I am using .NET 2.0 with C#.
I have a master page that I use across a couple of pages. Every web pages that uses this master page will have a different title, and maybe different meta key words and meta descriptions, etc.
I found a way of changing this, but I am not sure if this is the best way to do it??
In the code behind of my master page, I have various properties to set the page header, meta key words, meta description, meta identifier URL, meta robots, meta content language, and meta distribution. I have only included the properties of the page header and meta keys words, the rest works on the same principle:
// Properties (partial)
public HtmlHead PageHeader
{
get { return (HtmlHead)Page.Header; }
}
public string MetaKeywords
{
set
{
HtmlMeta keywords = new HtmlMeta();
keywords.Name = "keywords";
keywords.Content = value;
PageHeader.Controls.AddAt(2, keywords);
}
}
Lets say I have a default.aspx that uses this master page, then I would declare <%@ MasterType VirtualPath="~/App_MasterPages/AppMaster.master" %> at the top of the .aspx file. And then in the default.aspx.cx code behind file I would have the following partial piece of code in a method that sets the title and meta key words (called from Page_Load):
// Add the page title to the header element
Page.Title = "MyWebsite | Welcome";
// Add meta elements to the header element
Master.MetaKeywords = "keyword 1, keyword 2, keyword3";
Is there another way of doing this??
Please can someone advise me?
Regards
ma se
|
|
|
|
|
respected gurus
i have created a HTML table at runtime and i m adding label web controls to the column of the table.i just want to set the width of this label at runtime.
also how it can be set to autosize depending upon the text of the label.
thanks
ajay
|
|
|
|
|
Your lable should looc something like this
asp:label id="lblMyLabel" runat="server">Some text<br />
/asp:label>
Be shore to have the id and runat attribute on the lable.
This will bring a
protected System.Web.UI.WebControls.Label lblMyLabel;
in the code behind file for this page(if not, add it).
Now you can set the lables width by
lblMyLabel.Width = Unit.Parse("50%");<br />
or<br />
lblMyLabel.Width = Unit.Parse("64px");<br />
or<br />
lblMyLabel.Width = 54;<br />
If you don't sett the with of the label it will autosize it to the length of the
text, thus the tablecell of the table the lable is in, will of course have a mather to say on the length of the lable.
Hope it helps
Thomas
-- modified at 4:49 Tuesday 17th April, 2007
|
|
|
|
|
Hi,
I'm new in ASP.NET and I need some help urgently. I have a grid view onject and I have build a template object in one of the column, a dropdownlist. This drop down list will have 3 static list item : Deliver, Fulfill, Cancel which will always be shown on the grid view is visible.
Then I have pull out customer data from database and do some formating and each customer data will then be store in a arraylist. I will bind the arraylist to the gridview.
My problem is now, each customer data will have a status say customer X.status = Pending. I want to add this customer customer status to the dropdownlist in addition of the 3 static status and make the current status as selected item, How can I do that?
Regards,
Jia
|
|
|
|
|
I guess you got to write your code in the gridview itemdatabound event.
In the event first check the status of the customer, iam assuming you have a coulmn which has the customer status.
Later find the dropdown control in your datagrid and add your value accordingly
code might be like this:
private gridview1_itemdatabound(object sender, system.......datagrideventargs e)
{
dropdownlist ddl = (dropdownlist)e.item.findcontrol("id of ddl in ur temp column)
for(int i=0;i<gridview.items.count;i++)
{
="" ddl.insert(insert="" your="" values="" to="" be="" added="" dropdown)
.....................
.................
.............
=""
<div="" class="ForumSig">Gautham
|
|
|
|
|
First of all, the DropDownList should contain all the statuses that
is possible for a customer, så Pending should also be a Static value.
Second, it seems to me that inn your Customer database table you have a string
item that contains the status, this is not a good way of designing a database.
You should change it to an integer, where
Deliver = 1
Fulfill = 2
Cancel = 3
Pending = 4
... and so one.
This is because an integer takes less space and it is easyer to search with, and sort by.
Now youre template should look something like this:
<br />
asp:TemplateColumn HeaderText="Status"><br />
ItemTemplate><br />
asp:dropdownlist id="ddlStatus" runat="server" SelectedIndex="<%#ddlStatus.Items.IndexOf(ddlStatus.Items.FindByValue((DataBinder.Eval(Container, "DataItem.intStatus")).ToString()))%>"><br />
asp:ListItem Value="1">Deliver</asp:ListItem><br />
asp:ListItem Value="2">Fulfill</asp:ListItem><br />
asp:ListItem Value="3">Cancel</asp:ListItem><br />
asp:ListItem Value="4">Pending</asp:ListItem><br />
/asp:dropdownlist><br />
/ItemTemplate><br />
intStatus is the integer coulmn name in your database customer table.
Now when you databind your DataGrid the dropdownlist will get the selected item of
the status that the customer has.
|
|
|
|