|
cisco2103 wrote: I am pretty new to .Net
Perhaps you should step back do some research first.
only two letters away from being an asset
|
|
|
|
|
I would think asking an asp.net question on a forum devoted to asp.net could be considered a form of research.
|
|
|
|
|
cisco2103 wrote: I've tried putting them in the header section of the page but with no luck.
Just add Literal controls with the script as text, as children to Page.Header .
cisco2103 wrote: Not very familiar with Init and PreInit since I am pretty new to .Net What would I accomplish by doing this?
Nothing, really. It doesn't matter much when you add the controls to the page, as long as it's done before the renderinging, and that only rules out the Unload and Disposed events, AFAIK.
---
single minded; short sighted; long gone;
|
|
|
|
|
Use RegisterClientScriptBlock to add javascript to your page. Better yet, as you're referencing .js files ( which is always better ), just put the code direct into the aspx.
I tend to use registerclientscript block to create variables in my script which give me the names of ASP.NET generated controls, so I can interact with them in my javascript/AJAX code.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The following line
(Convert.ToDecimal(NET.Text) / 117.5 * 100).ToString()
creates the value - 42.55319148 ......
All i wantis 42.55
How do I go about this?
Thank
|
|
|
|
|
ToString("#.00") if you want to restrict and force 2 decimals places
ToString("#.##") if you want to restrict 2 decimals places
ToString("N2") equivalent to ToString("#.00")
|
|
|
|
|
You can use abs for absolute value. abs((Convert.ToDecimal(NET.Text) / 117.5 * 100)).ToString(###,###.##)
|
|
|
|
|
Thanks for that. I found i didnt need the abs though. It was just the formatting string on the tostring method that got me where i wanted. Although it would only accept it as a string so had to add " " around it.
Thanks
Convert.ToDecimal(NET.Text) / 117.5 * 100)).ToString("#.##")
|
|
|
|
|
Hi All
I created a web page on which I have a GridView. I took AccessDataSource as GridView's DataSource. On selection changing Event of gridview, I redirect selected Row's data to other form where User can Edit and get back to previous page. Its my need that I hve to redirect to new page for editing not in the GridView itself. Everything working fine but After Editing when I returned to GridView page, the GridView is not updated, It requres Refresh(f5) to show updated gridview. I tried GridView.DataBind() using IsPostBack but no benefit. Please Guide me , Thanks
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
mydb = new myDB();<br />
if (mydb.Conn.State == ConnectionState.Closed)<br />
mydb.Conn.Open();<br />
<br />
if (!IsPostBack)<br />
{<br />
<br />
if (Request.QueryString["GridIndex"] != null)<br />
{<br />
int GVIndex = Convert.ToInt32(Request.QueryString["GridIndex"]);<br />
string sortingField = Request.QueryString["SortingField"];<br />
string sortingOrder = Request.QueryString["SortingOrder"];<br />
SortDirection sd = new SortDirection();<br />
if (!sortingField.Equals(""))<br />
{<br />
if (sortingOrder.Equals("Ascending"))<br />
{<br />
sd = SortDirection.Ascending;<br />
GVRackMaster.Sort(sortingField, sd);<br />
}<br />
else<br />
{<br />
sd = SortDirection.Descending;<br />
GVRackMaster.Sort(sortingField, sd);<br />
}<br />
}<br />
GVRackMaster.PageIndex = GVIndex;<br />
GVRackMaster.DataBind();<br />
<br />
}<br />
}<br />
<br />
GVRackMaster.DataBind();<br />
}<br />
Bajrang Singh
Using .net 2.0 (VS2005)
|
|
|
|
|
After removing your if(!=PostBack) block the following is left;
protected void Page_Load(object sender, EventArgs e)
{
mydb = new myDB();
if (mydb.Conn.State == ConnectionState.Closed)
{
mydb.Conn.Open();
}
GVRackMaster.DataBind();
}
It appears that after the first time the page loads, your not updating your datasource. That would explian why you don't see the update unless you reload the whole page.
BTW, you should ad something to ensure that the mydb.Conn is closed when your done, just in case. Hope this helps!
|
|
|
|
|
Thanks mnvkng76 for Reply.
I am using AccessDataSource as DataSource of GridView. So when I update the Table RackMAster, AccessDataSource is updated automatically. So where is the need of updating DataSource. Second thing I don't know where Should i write code for closing the connection, PLease tell me.
Although I changed my connection code to
protected void Page_Load(object sender, EventArgs e)
{
if (mydb.Conn.State == ConnectionState.Open)
{
mydb.Conn.Close();
}
mydb.Conn.Open();
}
But problem remains the same.
AccessDataSource has nothing to do with mydb because I made AccessDataSource in design time so I don't thinks mydb can affect accessDataSource. Is there any way to Refresh AccessDataSource.
Hope to get a solution from u earliest. Thanks
Bye
Bajrang Singh
Using .net 2.0 (VS2005)
|
|
|
|
|
Closng the connection wont fix, the problem. Its just good practice to ensure that all your connection are closed when they are not needed. It prevents other problems.
Without seeing more of the code, it would be tough to debug further. Even though your working with a datasource created at design time, it still loads at runtime, so maybe the issue lies there.
|
|
|
|
|
Hi Developers
Screen Scrapping is a nice feature to extract all the contents of a Web Page. But I don't need to extract all contents of the web page rather I just need contents from One-Point-to-Another-Point.
For example on Sialkot Export I just want to get text from "Welcome to Sialkot Export..." to "...presence of Sialkot Exporters."
Lets work it Out.........!
|
|
|
|
|
And what problems are you having doing this? What have you tried so far?
only two letters away from being an asset
|
|
|
|
|
Actualy I need to extract data from almost 10,000 pages(dynamic pages). And If I recieve ALL THE DATA from each web page then it wud be quite time consuming...
Please let me know If my question is still not clear...!
Lets work it Out.........!
|
|
|
|
|
Web Guru..! wrote: Please let me know If my question is still not clear...!
My question was, what have you tried so far? Not how many pages you need to extract data from. IMO if it involves this many pages you need to come up with a different approach.
only two letters away from being an asset
|
|
|
|
|
I have mysql database named 'sample' which consists of a table named'masterprojects'
Now I need to access this database in a "*.aspx.cs" page.
I get an error message that
"Host '192.168.1.163' is not allowed to connect to this MYSQL server."
I think the problem is related to the user name and the password required to access this database.
My Connection String is something like-->
myConn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server= 192.168.1.163;Database=sample;User=localhost;Password='';");
Can anyone help me to know the default username and passwrd that is asssigned to mysql database.......
|
|
|
|
|
arpitcompro wrote: "Host '192.168.1.163' is not allowed to connect to this MYSQL server."
That's quite self-explanatory.
arpitcompro wrote: myConn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server= 192.168.1.163;Database=sample;User=localhost; password='';");
And where is your MYSQL server? On localhost? Try Server=127.0.0.1
To me it looks like you are trying to connect into wrong server, where you don't have permission to do so. Either change host name or contact administrator of server with IP 192.168.1.163
arpitcompro wrote: Can anyone help me to know the default username and passwrd that is asssigned to mysql database.......
Your MySql server administrator.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Hi, In my application, on click of an image, a calender popup is shown, which is another aspx page.
If i keep a button in calender.aspx page, then in 'onclick event' i send the selected date to the parent form...but i want to do this in selectionChanged event of the calender control...i do th following:
strSelectedDate = Calendar1.SelectedDate.ToString(objConfig.DateDisplayFormat);//Calendar1.SelectedDate.ToString("dd/MM/yyyy");
strFormName = Request.QueryString["FormName"];
strCtrlName = Request.QueryString["CtrlName"];
string strJava = "" +
"function ReturnDate()" +
"{" +
"window.opener.document.forms['<%= strFormName %>'].elements['<%= strCtrlName %>'].value = '<%= strSelectedDate %>';" +
"window.close();" +
"}" +
"";
How do i run this script in selecttionChanged event of calender control?
|
|
|
|
|
String.Concat
StringBuilder.Append
String.LookItUpInMSDN
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: String.LookItUpInMSDN
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
how to display time on webapplication with out using javascript code i.e means it has to work on server, why because page has to refresh for every min.for that purpose
|
|
|
|
|
The otherway is Ajax. But i have coded it before with Javascript only. I have not yet tried with Ajax.
Regards,
Satips.
|
|
|
|
|
Try reading the "How to get answers to your question" post at the top.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Very Urgent is not descriptive and will more likely be ignored
only two letters away from being an asset
|
|
|
|
|
displaying time in server with out using javascript and ajax general code
|
|
|
|