|
Hi I need a regular expression for 1.00E+05.. I am using [-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?|^$ but it is not working..its accepts any character after the numeric value i.e. its returns true for 100abcd, however this is wrong. Only a single e or E should accept.
Pankaj
|
|
|
|
|
Try: [-+]?([0-9]+)\.([0-9])+[eE][\+-]?[0-9][0-9]?
I strongly recommend you get a copy of Expresso[^] - it makes working with regexes so much easier...
[edit]eh up - one o me brackets vanished...it's back now![/edit]
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
|
Thanks for your help..but I need to allow blank also, means either there should be blank or valid value, but this expression does not allow blank, that's why I added |^$ at the end of the expression. But still not working properly.
Pankaj
|
|
|
|
|
Hi
I am using ManagementObjectSearcher for retrieving Hardware information. But following code returning hardware information of Server PC. But I need Hardware information of client PC. How can i get Hardware information of Client PC?
string Info=""; ManagementObjectSearcher Q;
Q = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_processor");
foreach (ManagementObject mo in Q.Get())
Info+= "<br />CPU Clock Speed: " + mo["CurrentClockSpeed"].ToString();
Q = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_ComputerSystem");
foreach (ManagementObject mo in Q.Get())
Info+= "<br />Total Physical Memory: " + mo["totalphysicalmemory"].ToString();
Q = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_LogicalDisk");
foreach (ManagementObject mo in Q.Get())
Info+= "<br />Serial Number of Drive(" + mo["Caption"] + "): " + mo["VolumeSerialNumber"];
|
|
|
|
|
asfak.ur.rahman wrote: I am using ManagementObjectSearcher for retrieving Hardware information. But following code returning hardware information of Server PC.
Yes, this would give you the information of Server.
You can't retrieve Client Information by using Normal JavaScript as it does not having sufficient rights to access system.
The alternative solution that you can implement is ActiveX but it will work only on IE.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
|
You can only access Request Header info to get info from the client. ManagementObjectSearcher will get you hardware info of the Host computer.
I guess, you can get IP of the computer and few other things only.
I think if you can make use of plugins like Silverlight or flash , you can extend this upto a certain extent but also be limited.
|
|
|
|
|
In my form, i have a date control which gets the date from UI in the following form:
dpickFromDate.Value=Convert.ToDateTime(DateTime.Today.AddMonths(-1).ToString("d",CultureInfo.CurrentCulture));
dpickToDate.Value=Convert.ToDateTime(DateTime.Today.ToString("d",CultureInfo.CurrentCulture));
However, the customer is complaining that Calendar control throws error when used with locales that have greater than 12 months to their calendars such as Thai.
Is it possible to fix the same by changing the above format? If so, how should it be changed? Is there is something wrong with the above conversion? please help.
I want to store the date in sql server also. So will it be a problem when storing if the number of months is more than 12?
Thanks
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi!
I have two public property in ascx. for the first time when the pageloads it works fine. but next time when I try to update the value of label control in ascx via aspx it says object ref not set to instance...
my codes
.ascx
public string CountryName
{
get { return lblCountry.Text; }
set
{
if (!(value == ""))
lblCountry.Text = value;
else
lblCountry.Text = "All Country";
}
}
public string AdType
{
get { return lblAdType.Text; }
set
{
if (!(value == ""))
lblAdType.Text = value;
else
lblAdType.Text = "All Ads";
}
}
.aspx
------
public string AdType
{
get { return _AdType; }
set { _AdType = value; }
}
if (!Page.IsPostBack)
{
if (!(Request.QueryString["q"] == null))
{
Session["AdType"] = Request.QueryString["q"];
}
if (Session["AdType"] != null)
{
AdType = Session["AdType"].ToString();
ddAdType.SelectedIndex = ddAdType.Items.IndexOf(ddAdType.Items.FindByText(AdType));
}
this.Left.AdType = ddAdType.SelectedItem.Text; <-- Left is a ascx here. and null ref exception is thrown at this line.
this.Left.CountryName = CountryName;
}
by default the adtype and countryname is empty so Left.ascx displays "All Country" and "All Ads". now when I click one of the link on Left.ascx that redirects to my .aspx?q=xyz
modified on Monday, November 16, 2009 8:10 PM
|
|
|
|
|
What is null ? Is it set in the aspx ? Given that the Page.IsPostback code means it won't run the first time, I assume it's always null....
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I have modified my post with extra code and explaination. I am not sure what I am doing wrong.
|
|
|
|
|
What is null ? Is it the selecteditem ? Seems most likely to me.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
no there is a value 'xyz for selecteditem.text.
|
|
|
|
|
OK, then Left must be null. Why do you expect that it's not null, where is it declared ? What's the property setter look like, might something inside there be null ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
how else can i access Left.ascx if its null. I am guessing aspx loades before ascx loads? before it wasnt the case and was working properly. so how can i ensure that i dont get this exception. thank you
|
|
|
|
|
No, if you declare it in your aspx, it should exist when your page load runs in the aspx. So, the questions I asked still need answering
1 - is it just declared in the aspx ?
2 - is it null when this is called ?
3 - what does the property setter do, might the null be in there ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
1. what is just declared in aspx? if you are refering to
this.Left.AdType = ddAdType.SelectedItem.Text;
yes it is just declared in aspx. please note both in aspx and ascx I have public property called AdType and CountryName.
2. It is not null when it loads first. it sets 'All country', 'All Ads' as coded in ascx properties. it is only null when i try to overwrite the value of those labels in ascx
3. I have posted the code for property in ascx. it simply sets the value of the label thats all.
|
|
|
|
|
Ok I am really confused it doesnt throw null ref exception all the time.
This is the exception that I get after first time "Object reference not set to an instance of an object"
modified on Monday, November 16, 2009 9:24 PM
|
|
|
|
|
ok i think its fixed. i had below in my left.ascx
<%@ OutputCache Duration="30" VaryByParam="none" %>
not sure why it was causing this?
|
|
|
|
|
I want to have some themes diferent models for the controls each one with a different SkinId in the themes file, and I want to be able to change all the controls of the site at the same time by only changing a variable, so if the variable has a value the controls get a sophisticated shape, but for other value they adopted a normal shape.
How can I do it without change te skinId of every control.
Regards
|
|
|
|
|
Thats what themes are for
Use a theme, and just change the theme
Alexei Rodriguez
|
|
|
|
|
|
i have the following code, i have a method named bindgrid(),
when i call this method with
if (postback==false) bindgrid();
i dont any problem
but if i do it only like bindgrid on page load event
so my button command does not work and also my edit command in gridview
does not work , although its working with is postbak ==false ,
but can you please tell me that where is the actual problem ,,
thanks , my code is bellow
<asp:scriptmanager id="ScriptManager1" runat="server">
<asp:updatepanel id="upanel" runat="server">
<contenttemplate>
<asp:gridview id="GridView1" runat="server"
="" autogeneratecolumns="False" datakeynames="customerid" showfooter="True" bordercolor="White" borderstyle="Ridge" borderwidth="2px" cellpadding="3" cellspacing="1" allowpaging="True" horizontalalign="Left" pagesize="5" onpageindexchanging="GridView1_PageIndexChanging" onrowcancelingedit="GridView1_RowCancelingEdit" onrowcommand="GridView1_RowCommand" onrowdeleted="GridView1_RowDeleted" onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing" onrowupdated="GridView1_RowUpdated" onrowupdating="GridView1_RowUpdating" onselectedindexchanged="GridView1_SelectedIndexChanged" width="1003px">
<rowstyle backcolor="#DEDFDE" forecolor="Black" wrap="True">
<columns>
<asp:templatefield headertext="Customer ID">
<footertemplate>
<%--<asp:button id="b2" backcolor="blue" commandname="Add" runat="server">--%>
<asp:button id="btnsave" text="Insert Record" commandname="Add" runat="server">
<asp:textbox id="add_customerid" runat="server">
<itemtemplate>
<asp:label id="lblcustomerid" runat="server" text="<%#Eval("customerid") %>">'
<asp:templatefield headertext="Company Name">
<itemtemplate>
<asp:label id="lblcompanyname" runat="server"
="" text="<%#Eval("companyname") %>">'
<edititemtemplate>
<asp:textbox id="up_txtcompanyname" runat="server" backcolor="green">
<footertemplate>
<asp:textbox id="add_txtcompanyname" runat="server">
<asp:templatefield headertext="Contact Tiltle">
<itemtemplate>
<asp:label id="lblctitle" runat="server" text="<%#Eval("contacttitle") %>">'
<edititemtemplate>
<asp:textbox id="up_contacttitle" runat="server" backcolor="green">
<footertemplate>
<asp:textbox id="add_contacttitle" runat="server">
<asp:templatefield headertext="City ">
<itemtemplate>
<asp:label id="lblcity" runat="server" text="<%#Eval("city") %>">'
<edititemtemplate>
<asp:textbox id="up_city" runat="server" backcolor="green">
<footertemplate>
<asp:textbox id="add_city" runat="server">
<asp:commandfield cancelimageurl="~/Cancel.gif" deleteimageurl="~/Delete.gif"
="" editimageurl="~/Edit.gif" showdeletebutton="True" showeditbutton="True" updateimageurl="~/Update.gif" buttontype="Image">
<footerstyle backcolor="#C6C3C6" forecolor="Black">
<pagerstyle backcolor="#C6C3C6" forecolor="Black" horizontalalign="Right">
<selectedrowstyle backcolor="#9471DE" font-bold="True" forecolor="White">
<headerstyle backcolor="#4A3C8C" font-bold="True" forecolor="#E7E7FF">
<editrowstyle wrap="False">
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
Tauseef A wrote: but if i do it only like bindgrid on page load event
so my button command does not work and also my edit command in gridview
does not work , although its working with is postbak ==false ,
but can you please tell me that where is the actual problem ,,
You should buy a basic ASP.NET book and read it, so that you understand the page lifecycle. The prerender event is fired after button events, load is fired before. By binding to your source before a click event, you reset the data source and lose the viewstate that contains your button click.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
can you explaing it more clearly please .
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|