|
if (dgvEmployee.CurrentRow.Index == -1) // Is there any row selected now?
return;
// Retrieve the first column from the selected row.
int Id = Convert.ToInt32(dgvEmployee.CurrentRow.Cells[0].Value.ToString());
This gives the particular value in the row of cell 0 ...If it help carry on
came out of hardwork
|
|
|
|
|
I have an XML file in my app_data directory. My Data Access layer (a class library project) needs to know where the XML file is.
I currently have:
c:\projects\My website\ (solution file is here)
c:\projects\My website\website (aspx files, web config, & junk)
c:\projects\My website\website\app_data\ (a few database files and an xml file)
c:\projects\My website\websiteDA\ (project folder for data access class library)
If I add the DA class library project as a reference to my website project, is there any way for the class library to know what the data directory of the website may be.
Using something like:
XmlTextReader settingsReader = new XmlTextReader("settings.xml");
tells me it's looking in:
C:\projects\My website\
the same folder as the solution file. Very odd. I would have expected c:\projects\My website\website
DB access gets around this by somehow parsing "|DataDirectory|" in the connection string, resolving it to match the app_data path. Could I do something similar?
-Mike.
|
|
|
|
|
|
That works if I'm trying to resolve a path from a page in the web project. However, I'm trying to accomplish the same from inside a class library referenced by the web project.
-Mike.
|
|
|
|
|
The class library code is running in appdomain of the web application so you have access to the HttpContext.Current.Server.
only two letters away from being an asset
|
|
|
|
|
I managed to solve my own problem, and here it is:
string strDataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory").ToString();
http://blogs.msdn.com/smartclientdata/archive/2005/08/26/456886.aspx
-Mike.
|
|
|
|
|
Have a menu control working fine, but need a couple tweaks. Example (assumes background white, hover background gray, also using css)
<asp:MenuItem Text="Cat" NavigateUrl="#" />
<asp:MenuItem Text="Persian" NavigateUrl="#" />
<asp:MenuItem Text="Calico" NavigateUrl="#" />
</asp:MenuItem>
<asp:MenuItem Text="Dog" NavigateUrl="#" />
<asp:MenuItem Text="Golden" NavigateUrl="#" />
<asp:MenuItem Text="Collie" NavigateUrl="#" />
</asp:MenuItem> Anybody know how or a tutorial that will show me how to do two things:
1. When hovering over "Collie", have the background of Dog be the hover color.
2. When hovering on "Collie" item but not on "Collie", have the entire item background be gray. Right now, if the text is short, and you hover to the right of the text within the item, the background remains white behind the text. I would like for the background to turn gray on the parent item, and the entire single item now matter where the mouse appears.
Thanks so much,
Janet
|
|
|
|
|
You'll need to use another control or write some custom javascript to handle these actions.
The menu control is rendered as a html table with the items as anchor tags in the cells. You would need to write some javascript to handle the onmouseover event of each anchor tag and adjust the colors as appropriate.
only two letters away from being an asset
|
|
|
|
|
When you say "use another control" - can you suggest one that would do as I would like? Or, would they all have the same rendering problem?
And/or, do you know of a control or someone who has written the onmouseover for the menu control as you have described? Perhaps one you could recommend for a fee?
The main thing I'm looking for is the parent to retain the 'hover' color when on it's child.
jb
|
|
|
|
|
Another third party control may provide better a experience for you. Without knowing your complete requirements or architecture I can't really recommend one.
If you want ot contact me offline we can discuss it further.
only two letters away from being an asset
|
|
|
|
|
I have a sumit button in aspx page.
function showProcessform()
{
Response.Redirect("processform.aspx");
return true;
}
when I click on button it doesn'r redirect me to processform.aspx page. It gives me error
seema
|
|
|
|
|
seemamltn wrote: It gives me error
That's nice. It's usually more helpful to include the error when asking for help.
In this case however it isn't necessary. You are trying to use a server method (Response.Redirect) from the client side in your Javascript. It won't work.
only two letters away from being an asset
|
|
|
|
|
|
Hi itsbijusamuel.
Is it possible making a javascript for server side using runat="server".
surprise??????
Bajrang Singh
Using .net 2.0 (VS2005)
|
|
|
|
|
I am building a shopping cart type web application. There are two web forms. The first web forms allows a user to select products. The second allows a user to enter quantities for each product selected in the first web form. I use a disconnected datatable to maintain and update selected products and quantities.
The problem is that the datagrid drops any quantity values entered by the user(there is only 1 input TextBox for each row in the datagrid). The code-
foreach(DataRow dr in dtShoppingCart.Rows)
{
if(((TextBox)dataGridItem.FindControl("txtSKU")).Text.ToString() ==
dr["SKU"].ToString())
{
dr["Quantity"] = ((TextBox)dataGridItem.FindControl ("txtQuantity")).Text.ToString();
break;
}
}
Any ideas?
|
|
|
|
|
Databinding is happening on the grid as it is being reposted to handle, which restores the textboxes to the original state.
Look at the Checkboxes and Textboxes section
http://www.codeproject.com/aspnet/datagriddemo.asp[^]
only two letters away from being an asset
|
|
|
|
|
Thanks. Looking at it now.
|
|
|
|
|
For the most part that makes sense. Currently I am using a datatable. Do I update the rows in the datatable in the OnQtyChanged method and then rebind that to my datagrid? Does the OnQtyChanged method a replacement for the onclick event I am using now?
|
|
|
|
|
wood0601 wrote: Do I update the rows in the datatable in the OnQtyChanged method and then rebind that to my datagrid?
Yes
wood0601 wrote: Does the OnQtyChanged method a replacement for the onclick event I am using now?
No
only two letters away from being an asset
|
|
|
|
|
Hey,
I am trying to place some plain text/html on my .net web page using the code behind page but I can't seem to do it.
Response.Write justs puts any text at the very top of my page and I can't work out if I have to use panels, placeholders or anything else to do the job. I can put a panel where I want it but the text is generated on the page load and needs to be postioned from there - or written into the relevant control, but I just cant work it out.
Can someone please help?
thanks
|
|
|
|
|
Use a control, such as label, and position it where you would like. Then in the code-behind set the text as appropriate.
only two letters away from being an asset
|
|
|
|
|
ok, that would be fine but...
I'm generating a written list of files within a specific folder that will need to be written to the page in the form of hyperlinks, each one having a different querystring attached.
As the folder and number of files change, I will not know how many individual lines I will need to write and would need to put each line in a new lable (correct me if i'm wrong, its a regular occurance).
any further suggestions?
thanks for the response
|
|
|
|
|
Use a repeater control. It can be bound to a list, such as the list returned from System.IO.Directory.GetFiles(). Then using databinding expression, or handling the events, the hyperlinks can be formatted as necessary. This will allow for flexibility in the number of items displayed and isolate the logic for obtaining the items.
only two letters away from being an asset
|
|
|
|
|
yey it worked!!
thank you very much for your help
I can go take some headache pills now
|
|
|
|
|
Hi currently the above application allow multiple widget instance in a column dropcue in top to bottom order.
I would like to find out anyway to restrict the number of widget appearing in a column to one only? This also means that the dropcue display will appear only when the column is empty and will not appear when the column already have one widget on it. thanks in advance!! help help!
cheers
|
|
|
|