|
You need to add an 'Edit Item Template' inside the grid view.
For that
2.Inside 'edit item template' put ur datepicker control(whatever it is).
<asp:TemplateField>
<EditItemTemplate>
<asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
</EditItemTemplate>
</asp:TemplateField>
Sherin Iranimose
|
|
|
|
|
Thank you for your response on this problem. Please my
Row_Updating not updating old value with new value. Remember i am using a datatable returned from my middle tier as the datasource to the gridview. If i was using the sqldatasource, i would not have this problem, but the problem im solving requires that i should use a datatable. One user will create the detail table while the other user will use the information from the first user, then update that with his own and save it into another table. Sorry for labouiring you people with this details.
See my code below
Protected Sub grdPhases_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles grdPhases.RowUpdating
If Not Session("biddetail") Is Nothing Then
oDT = Session("biddetail")
End If
grdPhases.DataSource = oDT
If e.NewValues("PhaseCost") IsNot Nothing Then
e.NewValues("PhaseCost") = Decimal.Parse(e.NewValues("PhaseCost").ToString(), Globalization.NumberStyles.Currency)
Else
lblPhaseCost.Visible = True
e.Cancel = True 'cancels the operation being performed
End If
If e.NewValues("StartDate") IsNot Nothing Then
lblPhaseCost.Visible = False
Else
lblPhaseCost.Text = "Enter the Start Date for this phase"
lblPhaseCost.Visible = True
e.Cancel = True 'cancels the operation being performed
End If
If e.NewValues("EndDate") IsNot Nothing Then
lblPhaseCost.Visible = False
Else
lblPhaseCost.Text = "Enter the End Date for this phase"
lblPhaseCost.Visible = True
e.Cancel = True 'cancels the operation being performed
End If
If Not IsDate(e.NewValues("StartDate")) Then
lblPhaseCost.Text = "Invalid Start Date"
lblPhaseCost.Visible = True
e.Cancel = True 'cancels the operation being performed
Else
lblPhaseCost.Visible = False
End If
If Not IsDate(e.NewValues("EndDate")) Then
lblPhaseCost.Text = "Invalid End Date"
lblPhaseCost.Visible = True
e.Cancel = True 'cancels the operation being performed
Else
lblPhaseCost.Visible = False
End If
'Dim strFind As String = "PhaseCode='" & e.OldValues("PhaseCode") & "'"
'Dim RowFound() As DataRow = oDT.Select(strFind)
'For j As Integer = 0 To RowFound.GetUpperBound(0)
'only 1 row
e.OldValues.Item("Description") = e.NewValues.Item("Description")
e.OldValues.Item("StartDate") = e.NewValues.Item("StartDate")
e.OldValues.Item("EndDate") = e.NewValues.Item("EndDate")
e.OldValues.Item("PhaseCost") = e.NewValues.Item("PhaseCost")
'Next
Session("biddetail") = oDT
'Set EditIndex=-1 to exit editing mode and rebind teh gridview to the
'datasourecto refersh
grdPhases.DataSource = oDT
grdPhases.EditIndex = -1
End Sub
t.aransiola
|
|
|
|
|
Hey
I am creating a site which allows users to customise their own area (no it is not a myspace clone - it isnt even social networking based).
I was just wondering if any one with experience could help me with my problem:
When creating the themed pages do I:
a) Dynamically create new pages for each user when they sign up
b) Dynamically create pages when a user requests to see the themed area
c) Both these ideas are complete twoddle and there is a better way of doing things (please expand and dont just say your an idiot Dan)
Thanks
Dan
|
|
|
|
|
Its ok I wasnt looking hard enough - ASP.NET supports themes - for any one else stuck on this:
http://msdn2.microsoft.com/en-us/library/tx35bd89.aspx
Dan
|
|
|
|
|
hii...suddenly i am facing a peculiar situation...
when i try to create a new project...i get the foll message...
i am using .net 1.1
The web server reported the following error when attempting to create or open the Web Project located at the Following URL:http://localhost/Webapplication1’.HTTP/1.1 500 Internal Server Error’
Ahsan
|
|
|
|
|
I dunno the root cause of the problem, but I have a quick solution.
Delete the ASPNET user account and then run aspnet_regiis with the -i switch.
SG
|
|
|
|
|
HI
Re install the IIS. I think this problem is from IIs only. This is as per my knowledge.
Thank you
Suresh.R
|
|
|
|
|
Hey,
I have a Grid view with four bound columns and one bound button column. When the bound button column is pressed I want to catch it and trigger some code. The code that I want to trigger requires the unique id of the column which I also display using the first bound column. Now I know I could put the id column in a template column and use findcontrol() to get its value but I was hoping I could just leave it as is.
I am using the RowCommand event to catch the press of the button. Does any one know the simplest and best way to do this. I have attempted to use datakeys but they dont seem to work in the right way.
Thanks
|
|
|
|
|
Use a Template column, place a normal button, set the CommandArgument to the databound filed name using following syntax <%#Eval("COL_NAME")%>. In the row command of the gridview get the command argument value from the event argument.
Regards,
Prakash Kalakoti
|
|
|
|
|
Thanks for that. But is there no way to grab a boundcolumns values instead. So I dont have to use the template column?
|
|
|
|
|
i am creating an instance for the Word.Application Class in my page to open the word document and save it as html. But the following error occurs
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005.
Need Help
Shaki
|
|
|
|
|
I have only had a quick look at your error but i remember this being an access denied error code (or a kind of catch all code) but have a look at this article
http://support.microsoft.com/kb/278013
I hope it helps
Dan
|
|
|
|
|
Hi,
I am using a .net adrotator control to handle banner etc ads throughout a site. A new new advertiser has come along and their ads are to be served via doubleclick. The problem I am having is that they have only given me code which in turn will request the ad and the hyperlink from their servers. This of course won't work with my setup.
<SCRIPT SRC="http://ad.uk.doubleclick.net/adj/N4419.xxxx/B2303055;sz=630x90;abr=!ie;ord=[Timestamp]?"></script>
<NOSCRIPT>
<a href="http://ad.uk.doubleclick.net/jump/N4419.xxxx/B2303055;sz=630x90;abr=!ie4;abr=!ie5;ord=[Timestamp]?">
<img src="http://ad.uk.doubleclick.net/ad/N4419.xxxx/B2303055;sz=630x90;abr=!ie4;abr=!ie5;ord=[Timestamp]?" width="630" height="90" border="0" alt=""></a>
</noscript>
Ive tried putting the src & href code into my xml file but it doesnt work.
Anybody had anythink similar?
Thanks in advance
Shaun
If I had all the money I'd spent on drink, I'd spend it on drink.
|
|
|
|
|
hi friends,
please help me.
the problem is with cookies ie
when i change one cookie value all otheer cookies are changing.
but i dont want to change all cookies.iam using cookie collection.
this is the ex code :
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = Request.Cookies["TC"]["one"];
TextBox2.Text = Request.Cookies["TC"]["to"];
TextBox3.Text = Request.Cookies["TC"]["Three"];
Response.Write(Request.Cookies["TC"]["MAX"]);
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("Click event");
Request.Cookies["TC"]["one"] = "900";
// Response.Redirect("testCookie.aspx");
}
please help me to solve this problem
|
|
|
|
|
Use Request.Cookies to read cookies and Response.Cookies to write cookies.
---
single minded; short sighted; long gone;
|
|
|
|
|
I have a dropdown list that bind my data into my gridview. Everything works fine except that when changing my selected data from my dropdown I noticed that the new loaded data in my gridview was on the same page that was when you were in the previous data, How to bring it up to the first page when a new selected data from the dropdown.
For instance, if you're on the 3rd page of the in the list and switch to new data from the dropdown you will start out on page 3, not the first page of the list
Thanks in advance for the help...
|
|
|
|
|
On the dropdown selected index changed Set the grid page index to the first page.
SG
|
|
|
|
|
Thanks for the reply.. I set the property for the gridview pageindex to 1 but the dropdown selected index changed was not availble function.. should I do this way..
.. Page_Load
if isPostback then
if me.dropdownlist1.selectedIndex.CompareTo - 1 then
me.gridwiew1.pageindex(1)
end if
end if
Pls correct my coding, Thks
|
|
|
|
|
hi all,
how to access hidden and visible columns in update event of datagrid?
here i have first column is invisible and and second column is visible.so how can i access the invisible first column and also the visible second column.
any links or suggestions are welcome.
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
All columns, visible or invisible are accessed in the same way programmatically. The invisible columns are just hidden from the design and runtime view, but still exist in the object.
SG
|
|
|
|
|
but i get error accessing them can u just say me the code snippet to access them using vb.net
thanks in advance
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
Hi all,
My apologies if this is an easy one (v.new to this!) but I get the following error when clicking edit a datagrid with a dropdownlist.
'System.IndexOutOfRangeException: StatusID'
In my datagrid I'm calling functions in VB. One to get the status and populate a Dataset & one to get selected index so I can set the initial value of the dropdownlist.
I then have the update sub to declare the dropdownlist and and update the database.
Would anyone be able to point me in the right direction?
Many Thanks
Rob
|
|
|
|
|
Is status ID a valid identifier for the drop down list's selected index property?
Do you really want the selected rows index?
If possible could you post the code so I can see what you are doing please?
Dan
|
|
|
|
|
Hi Dan, thanks for the reply.
Here is my code showing functions to populate the dataset and to get the selected row.
StatusID is the primary key in my access database & thought I'd need to use it to default the value of the dropdownlist to the current value.
Function GetStatus() as DataSet
Dim DBConn as OleDbConnection
Dim DBCommand as OleDbDataAdapter
DBConn = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("data/Auto_log.mdb") & ";")
DBCommand = New OleDbDataAdapter("SELECT StatusID, Status from Status ORDER BY Status", DBConn)
DBCommand.Fill(DS, "Status")
DBConn.Close()
Return DS
End Function
Function GetSelectedIndex(ByVal StatusID As String) As Integer
'Loop through the DataSet DS
Dim iLoop As Integer
Dim DT As DataTable = DS.Tables("Status")
For iLoop = 0 To DT.Rows.Count - 1
If StatusID = DT.Rows(iLoop)("StatusID").ToString Then
Return iLoop
End If
Next iLoop
End Function
I then declare the ddl in my update subroutine as follows
Dim ddlStatus As DropDownList = FindControl("ddlStatusctrl")
and here is the ddl control from my datagrid:
<asp:TemplateColumn>
<HeaderTemplate>
Status
</HeaderTemplate>
<ItemTemplate>
<%# Container.DataItem("Status") %>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList id="ddlStatusctrl" runat="server"
DataTextField="Status"
DataValueField="StatusID"
DataSource="<%# GetStatus() %>"
SelectedIndex='<%# GetSelectedIndex(Container.DataItem("StatusID")) %>' />
</EditItemTemplate>
</asp:TemplateColumn>
Rob
|
|
|
|
|
Did anybody know how to help others , may be students, developers, through coding,may be ASP.Net, C#.Net And
have some earning from that. If anybody knows, plz tell me the website or any resource through which i can do that.
Bijay Bhaskar Deo
Thanks & Regard
|
|
|
|