|
Still not quite sure what you're trying to do... update every row of the field date column?
cheers
P
|
|
|
|
|
While hard-coding the DropDownlist entries, i hope you have set both Text and Value properties. if not go to the properties window of the dropdown list and click on the columns property, which will pop up new window enabling you to enter Text and Value propeties for that ddlist. if you are binding the DD list in code behind code then follow as below
DropDownList1.Items.Insert(0,"1day");<br />
DropDownList1.Items[0].Text="1 day";<br />
DropDownList1.Items[0].Value="1";<br />
<br />
DropDownList1.Items.Insert(1,"2days");<br />
DropDownList1.Items[0].Text="2 days";<br />
DropDownList1.Items[0].Value="2";
go on filling the DropDownList1 as shown above.
string val = DropDownList1.SelectedValue.ToString();
will give the Selected value of the DropDownList1
now below code will change the value of the DataGrid1 Cell values for the entire date Column.
here it si assumed that Date column is the first column. if the Column position is n then replace Cell[0] with Cell[n-1]
for(int i=o;i<DatGrid1.Item.Count;i++)<br />
{<br />
DataGrid1.Item[i].Cells[0].Text = Convert.ToDateTime(DataGrid1.Item [i].Cells[0].Text.ToString().AddDays(Convert.ToDouble (DropDownList1.SelectedValue.ToString())).ToString("MM/dd/yyyy") ;<br />
}
Above Single line of code can replaced as given below
string DDval = DropDownList1.SelectedValue.ToString();<br />
for(int i=o;i<DatGrid1.Item.Count;i++)<br />
{<br />
DateTime CellVal = Convert.ToDateTime(DataGrid1.Items[i].Cells[0].Text.ToString());<br />
<br />
CellVal = CellVal.AddDay(DropDownList1.SelectedValue.ToString());<br />
<br />
DataGrid1.Item[i].Cells[0].Text = CellVal.ToString("MM/dd/yyyy"); <br />
<br />
}
once the values have been changed in the datagrid it is up to you to update the same to the database.
Cheer
Ramesh.Kanjinghat
|
|
|
|
|
in the above code the fopr loop is not printed prperly
for(int i=0;i<DataGrid1.Items.Count;i++)<br />
{<br />
DataGrid1.Item[i].Cells[0].Text = Convert.ToDateTime(DataGrid1.Item [i].Cells[0].Text.ToString().AddDays(Convert.ToDouble (DropDownList1.SelectedValue.ToString())).ToString("MM/dd/yyyy") ;<br />
<br />
}
and repeat the same for the next for loop
Ramesh.Kanjinghat
|
|
|
|
|
Hello all,
I have created an Activex control using VC++.Using the object tag ,i call its dll in asp.net page.
<object ID="AxPlayer"<br />
classid="clsid:AFB6AA3F-5D76-41E4-B6D9-6AD20026A988"<br />
codebase="http://localhost/ActiveX/AxPlayer.dll#Version=1,0,0,3"<br />
hspace=0<br />
vspace=0 ><br />
<br />
</object>
Since the Dll size is in Mbs ,it takes more time to download and showing white space in the Page while downloading.
I need to keep flash in the page showing the text "Activex control is Downloading".
1.how to do that??.
2.i need to play the flash only when the dll downloads.
please help me.
cheers
sangeet
-- modified at 5:23 Wednesday 3rd May, 2006
|
|
|
|
|
How about adding a table with a cell that has a background image with the text "ActiveX control is downloading".
Inside the cell you add your Flash object code.
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
thanks for ur reply
yes i can add a table with a cell.
But i need to make the table invisible after dll downloads.
so first i need to find whether dll is downloaded or not.
how do i find that..
cheers
sangeet
|
|
|
|
|
You can just set border="0" on the table which will keep the table invisible
<table border="0" width="100%">
<tr><td align="center" bgimage="downloading.jpg">
<object .... etc.
FLASH
</object>
<td>
</tr>
</table>
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Hi everybody.
I got the following Exception when i try to hide a column filled by a dataset:
Index was out of range. Must be a non-negative and less than the size of the collection. Parameter name : index
I dont understand why i got this error because when i try to get a data from this column with Gridview.Rows[myrow].cells[thecellofmycolumn].Text , I have no error.
Does anyone got an idea how to resolve it?
Thx
|
|
|
|
|
What's the code that gives the error? Where is it called from?
|
|
|
|
|
I do this in the Page_Load. here is the code:
Gridview.DataSource = MyDataSet;<br />
Gridview.Databind();<br />
Gridview.Columns[1].Visible = false;
When i try to get a value of this column i don t have any error. here is the code to get a value:
string value = Gridview.Rows[MyRow].Cells[1].Text;
-- modified at 7:32 Wednesday 3rd May, 2006
|
|
|
|
|
I have an asp.net Web App and I have a bunch of classes that hold the information from a page for example, I have a page form.aspx and it initialises a class info.class which holds all the information.
Now when I click a button on that page the class loosing all its values and the are set to null again. Does view state not save this class or is it just for front end things like textboxes,
If I can't do it with view state:
Should i store the class it in a DB
or session var
or in the cache????????
Thanks in advance
|
|
|
|
|
You can store it in viewstate, but you have to code it yourself:
Viewstate("MyClass") = myClassInstance
and to return it:
myClassInstance = ViewState("MyClass")
however, your class must be serializable to save correctly. If your class is very large, you may want to consider using session instead, as everything in viewstate will be sent over the wire to the client.
If you store it in cache, then the same data will be used for every user of the application.
|
|
|
|
|
Hello,
Hope you all will be fine,I want to send multiple values through "location.href" after getting these values from DropDownList in ASP.net using C#, How can i do that? the DropDownList is in HTML not <asp:dropdownlist>. The code is like that;
location.href='addsuccess.aspx?color='+<%=colordropdown%>.options[<%=colordropdown%>.selectedIndex].value
Moreover I am calling this on "onClick" Event of an Image.
Hope you will understand,
Regards,
AbuBakar
|
|
|
|
|
Would it not need to be something more like this:
location.href='addsuccess.aspx?color='+<%=colordropdown.options[colordropdown.selectedIndex].value%>
|
|
|
|
|
Yes paddyboyd you are right it is working quite well but in this way i can only pass one value like color but in real case i want to pass more than one value so how is it possible to pass more than one values in following string ???????
location.href='addsuccess.aspx?color='+<%=colordropdown.options[colordropdown.selectedIndex].value%>
Regards
|
|
|
|
|
Separeate the values using the & character, e.g. create an url in the format:
addsuccess.aspx?color=3&something=42
---
b { font-weight: normal; }
|
|
|
|
|
hi friends,
i need to use lucene - wildcard search, but i don't know how to do it, is anybody has done this here before, please give me the piece of codings.and also please tell me, how to search if my starting characters is in German Language like ä.
kpsetty
|
|
|
|
|
|
Hi,
If I want to save an uploaded file to subfolderX I can use this:
objFile.SaveAs(Server.MapPath("subfolderX\" & savedFilename))
OK, no problems. But now I want to check that subfolderX exists, and create it if it doesn't. So I do this:
If Not System.IO.Directory.Exists(Server.MapPath("subfolderX")) Then
System.IO.Directory.CreateDirectory(Server.MapPath("subfolderX"))
End If
OK, no problem. This works.. on my local machine. When I try it on my ISP's server I get an error: "Could not find a part of the path e:"
When I contacted them they suggested I try hard-coding the fully qualified network path instead:
If Not System.IO.Directory.Exists("\\iisX\domains\x\....\subfolderX") Then
System.IO.Directory.CreateDirectory("\\iisX\domains\x\...\subfolderX")
End If
This works - but why doesn't Server.MapPath, esp given that it DOES work for saving files??!! This doesn't make sense to me...
I don't want to use the hard-coded version if possible, as it doesn't lend itself well to the application's portability.
Any deas, anyone...?
thanks
Phil
|
|
|
|
|
Try printing out what path the Server.MapPath() method returns, and see if this helps.
The reason the createdirectory doesn't work seems to have to do with the fact that your application is hosted on a different machine internally in the hosting company, since you have to give them the full networkpath.
How about it if you try with the Tilde "~" character (implying the current application)?
Server.MapPath("~/subfolderX")
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Jakob Lund Krarup wrote: Try printing out what path the Server.MapPath() method returns
I have - it gives "e:\...." (etc)
Jakob Lund Krarup wrote: How about it if you try with the Tilde "~" character
Same as above.
Jakob Lund Krarup wrote: The reason the createdirectory doesn't work seems to have to do with the fact that your application is hosted on a different machine internally in the hosting company, since you have to give them the full networkpath.
Weel, yes... but why then does
objFile.SaveAs(Server.MapPath("subfolderX\" & savedFilename))
work fine but
System.IO.Directory.CreateDirectory(Server.MapPath("subfolderX"))
not? That's the really puzzling thing.
thanks
Phil
|
|
|
|
|
I dont think anyone other than your hosting comany could possibly give you a definitive 100% accurate answer - but the chance of finding and speaking to a programmer there that understands such matters is slim!.
I can tell you that Server.MapPath works better the more of the path it has to go on. So, in your case you say that this works:
objFile.SaveAs(Server.MapPath("subfolderX\" & savedFilename))
so you are giving it quite alot to go on
Server.MapPath("subfolderX\myfilename.ext")
the one you say does not work has less to go on
Server.MapPath("subfolderX")
if you know the folder above subfolderx, you might try prepending that to give MapPath more of a hint, but I cant guarantee that will make any difference whatsoever.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Thanks - but didn't help.
This is so odd - the line that checks if the folder exists works:
If Not System.IO.Directory.Exists(Server.MapPath("subfolderX")) Then
because if I replace subfolderX with one that does already exist then it returns true; but if subfolderX doesn't then
System.IO.Directory.CreateDirectory(Server.MapPath("subfolderX"))
fails with a "Cannot find part of path" error. As I can create folders by hard-coding the network path I assume it isn't a permissions thing. (Unless there are different permissions to creating network folders from virtual ones..? Never have understood this side of things...) And saving files works.
J4amieC wrote: but the chance of finding and speaking to a programmer there that understands such matters is slim!.
Indeed....!
Oh well... thanks for trying folks
cheers
P
|
|
|
|
|
Hello There
There is a search form in my scenario in which user will fetch say 100 records in one go. and then he has button "Next 100". Now I am adding the next button dynamically . but the addhandler is not working.
Can any one help me how to make sure that handler should work. The code is
' I have a server side table in which I am adding rows and cells
Dim cellBtnPrevious As New System.Web.UI.WebControls.TableCell
Dim btnRow As New System.Web.UI.WebControls.TableRow
Dim BtnPrevious As New System.Web.UI.WebControls.Button
Dim BtnNext As New System.Web.UI.WebControls.Button
Dim BtnWidth As New System.Web.UI.WebControls.Unit(100)
BtnPrevious.Width = BtnWidth
btnNext.Width = BtnWidth
BtnPrevious.Text = "Previous"
BtnNext.Text = "Next"
AddHandler BtnNext.Click, AddressOf NextRecords
AddHandler BtnPrevious.Click, AddressOf PreviousRecords
cellBtnNext.Controls.Add(BtnNext)
cellBtnPrevious.Controls.Add(BtnPrevious)
btnRow.Cells.Add(cellBtnNext)
btnRow.Cells.Add(cellBtnPrevious)
tblContents.Controls.Add(btnRow)
'' The definition of one function is
Private Sub NextRecords(ByVal sender As System.Object, ByVal e As System.EventArgs)
'' code here
end sub
Thanks
Regards
Rizwan Bashir
|
|
|
|
|
I am defining relationship between datatables by using oracle as the backend.
It works fine in sql but in oracle it prompts an error "OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT"
my code for SQL is
Imports System.Data
Imports System.Data.SqlClient
Dim conn1 As New SqlConnection("Server=ibmserver;database=Northwind;User id=ADMINISTRATOR;Password=ADMIN")
conn1.Open()
Dim ds1 As New DataSet
Dim str1 As String = "select * from_categories"
Dim str2 As String = "select * from products"
Dim adapter1 As New SqlDataAdapter(str1, conn1)
adapter1.Fill(ds1, "categories")
adapter1.SelectCommand = New SqlCommand(str2, conn1)
adapter1.Fill(ds1, "products")
ds1.Relations.Add("categories_products", ds1.Tables("categories").Columns("categoryID"), ds1.Tables("products").Columns("categoryid"))
Dim categories As DataTable = ds1.Tables("categories")
DataGrid1.DataSource = ds1.Tables("categories")
DataGrid1.DataBind()
DataGrid2.DataSource = ds1.Tables("categories.categories_products")
DataGrid2.DataBind()
******************************************************************************
my code for oracle is
imports system.data.oledb
dim myConn as OledbConnection
dim myDa as oledbDataAdapter
dim myDa1 as oledbDataAdapter
dim drowParent as datarow
dim drowchild as datarow
dstDT = new dataset()
myConn=New OleDbConnection("Provider=MSDAORA.1;User ID=jewellman;password=jewellman;Data Source=orcl;Persist Security Info=False")
myDa = new oledbdataadapter("Select * from designTransactions",myConn)
myConn.open()
myda.fill(dstDT,"designtransaction")
myDa.selectcommand=new oledbcommand("Select * from designcustomerapprovel",myconn)
myda.fill(dstDT,"designcustomerapprovel")
dstDt.relations.add("DesignApprovel",dstDT.tables("designtransactions").columns("id"),dstDt.Tables("designcustomerapprovel").columns("categoryid"))
myConn.close()
|
|
|
|