|
Hi!
Thanks Apurva...
I got the solution with the help of u..
Thanks.,
Bye...,
T.Prabu
|
|
|
|
|
always welcome....
Best Regards,
Apurva Kaushal
|
|
|
|
|
i am creating a project in which i am creating a navigation links .which is use to redirect from page to page.
I want to create navigation links such a way that links should appear based on user rights.
For example if a person is login as administrator he will see all 30 links
If he is user he will see only 4 links. I am fetching the urls from database
Pls help me it is urgent
|
|
|
|
|
You can dynamically generate hyperlink control and then display it, depending upon the count from the database.
Best Regards,
Apurva Kaushal
|
|
|
|
|
U can put these Hyperlinks in rows or column dependinf on u...
then in javascript what u can do is check whether user is admin or not..
write these Code:
<%if(session("user")="Admin" %>
t1.style.display='block';t2.style.display='block';
<%end if%>
<%if(session("user")="NOTADMIN" %>
t1.style.display='none';t2.style.display='none';
<%end if%>
--t1,t2 here stands for ids of row1,row2 respectively
--Block will display the row and none will not display that row
--this way u can do for n number of rows
|
|
|
|
|
Hi, How to Sort Sort a DataGrid on Client Side.
|
|
|
|
|
Ask this girl[^] for the sample code.
|
|
|
|
|
Hi,
I have an aspx page which refers to a master page. In the child page, I have to refer and retrieve the text of a server side textbox of the same page.And this text should be displayed in the browser's status bar.To display the text in status bar, I can use window.status in javascript. But, how can we access that server control's value from script??
Any suggstions....Please welcome....Thanq
-Priya
|
|
|
|
|
I usually solve this by typing out the value from the server control to the page to a javascript variable that i can use by the script later. Typically:
myLiteral.Text = ""
myLiteral.Text += "var myVar=" + theValue;
myLiteral.Text += ""
Controls.Add(myLiteral)
Then use the variable myVar on the client!
|
|
|
|
|
i keep having runtime errors everytime i try to update my database in the datalist. Can someone pls help me rectify them?
aspx. file
this is in the EditItemTemplate of the datalist control.
<br />
<EditItemTemplate><br />
<table width="100%" height="100%" cellpadding="1" border="1"><br />
<tr><br />
<td style="width: 54px"><br />
<%#DataBinder.Eval(Container.DataItem, "ID")%><br />
</td><br />
<td style="width: 300px"><br />
<%#DataBinder.Eval(Container.DataItem, "checklist_Item")%><br />
</td><br />
<td style="width: 230px"><br />
<asp:TextBox ID="txtEventDate" text='<%#DataBinder.Eval(Container.DataItem, "date_Completed")%>' runat="server"></asp:TextBox</td><br />
<td style="width: 160px"><br />
<asp:TextBox ID="txtEventTrigger" text='<%#DataBinder.Eval(Container.DataItem, "date_Trigger")%>' runat="server"></asp:TextBox><br />
</td><br />
<td style="width: 100px"><br />
<asp:Button ID="btnUpdate" CommandName="Update" Text="Update" runat="server" /></td><br />
</tr><br />
</table><br />
</EditItemTemplate><br />
aspx.vb file
Sub MyDataList_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles MyDataList.UpdateCommand<br />
Dim tbox As TextBox<br />
Dim ID As String<br />
'Dim txtEventDate, txtEventTrigger As Date<br />
'Dim ID, txtEventDate, txtEventTrigger As String<br />
Dim txtEventDate, txtEventTrigger<br />
<br />
'---retrieves the key for the row---<br />
ID = MyDataList.DataKeys(e.Item.ItemIndex)<br />
'MsgBox("1")<br />
<br />
'---find the textbox control containing the title<br />
tbox = CType(e.Item.FindControl("txtEventDate"), TextBox)<br />
txtEventDate = tbox.Text<br />
'MsgBox("2")<br />
<br />
'---find the textbox control containing the price<br />
tbox = CType(e.Item.FindControl("txtEventTrigger"), TextBox)<br />
txtEventTrigger = tbox.Text<br />
'MsgBox("3")<br />
<br />
'---updates the database---<br />
Dim sql As String = "UPDATE programs SET date_Completed='" + txtEventDate + "' , date_Trigger='" + txtEventTrigger + "' WHERE ID='" + ID + "'"<br />
Dim comm As New OleDbCommand(sql, objConn)<br />
'MsgBox("4")<br />
<br />
objConn.Open()<br />
'MsgBox("5")<br />
comm.ExecuteNonQuery()<br />
MsgBox("6")<br />
objConn.Close()<br />
<br />
MyDataList.EditItemIndex = -1<br />
'MyDataList.DataBind()<br />
LoadData()<br />
<br />
<br />
End Sub
The error as displayed:
Data type mismatch in criteria expression.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Data type mismatch in criteria expression.
Source Error:
Line 76: objConn.Open()
Line 77: 'MsgBox("5")
<code>Line 78: comm.ExecuteNonQuery()</code>
Line 79: MsgBox("6")
Line 80: objConn.Close()
Stack Trace:
[OleDbException (0x80040e07): Data type mismatch in criteria expression.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +177
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +194
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +56
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +105
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +88
Tracking.Default1.MyDataList_UpdateCommand(Object source, DataListCommandEventArgs e) in C:\Documents and Settings\username\My Documents\Visual Studio 2005\Websites\WebSite2\Default.aspx.vb:78
System.Web.UI.WebControls.DataListCommandEventHandler.Invoke(Object source, DataListCommandEventArgs e) +0
System.Web.UI.WebControls.DataList.OnUpdateCommand(DataListCommandEventArgs e) +75
System.Web.UI.WebControls.DataList.OnBubbleEvent(Object source, EventArgs e) +228
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.DataListItem.OnBubbleEvent(Object source, EventArgs e) +117
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +85
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4918
frossie
|
|
|
|
|
Hi,
The Error might be [Datatype in the database must be numeric and you are assigning a string to it], If your database is ms-access use "#" for the date columns.
|
|
|
|
|
can you show me an example code to put in access or the codefile?
becos i don really get what u say.
frossie
|
|
|
|
|
You can check the query which you are generating, check that query by executing it in backend first.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi,
check this out,
(1)
"UPDATE programs SET date_Completed=#" + txtEventDate + "# , date_Trigger=#" + txtEventTrigger + "# WHERE ID='" + ID + "'"
(2)
"UPDATE programs SET date_Completed=#" + txtEventDate + "# , date_Trigger=#" + txtEventTrigger + "# WHERE ID=" + ID
for (1)
provided [date_completed is date, date_trigger is date and ID is string] in database
for (2)
provided [date_completed is date, date_trigger is date and ID is numeric] in database
display this query string in ur browser and copy paste in database, run it out and check.
|
|
|
|
|
ok thanks alot.
it finally solved that problem.
frossie
|
|
|
|
|
If (ID = 2) Then<br />
<pre>TextBox1.Text = ds.Tables("programs").Rows(ID).Item(2)</pre><br />
Dim temp1 As New DateTime(Year(TextBox1.Text), Month(TextBox1.Text), Day(TextBox1.Text))<br />
MsgBox("temp1=" + temp1)<br />
temp1 = temp1.AddDays(7)<br />
ds.Tables("programs").Rows(ID + 1).Item(3) = temp1<br />
<br />
End If
i keep getting this error "Object reference not set to an instance of an object". Why isit so?
frossie
|
|
|
|
|
Which line you get the error? Check whether that object exists or not.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Can you help me complete this ASP.NET exercise wsing Visual Studio 2003?
Your employer wants you to create a shopping cart application. First, create a database called ShoppingXXX (xxx are your initials). For this exercise you will be using Microsfoft ACCESS.
Include the name of the product, price, description, and the product ID.
Create sample data (be creative, you are suppose to be having fun).
Create a web page that displays the data using a DataGrid control.
Format the dataGrid using the Property Builder.
Add your photo, graphics, color, and content to enhance the appearance of the page.
Do all of your work in one folder (all files, database, and graphics). Everything must be in the one folder.
Can you help me with the code I need for this exercise?
Any help would be greatly appreciated.
Thank you very much!!
Kevin
|
|
|
|
|
TheKiwi wrote: Can you help me with the code I need for this exercise?
The short answer is no.
The longer answer is found here[^].
If you want to ask a specific question, or ask for help solving a specific problem you're having, I'm sure you'll find there are many folks here willing to help.
|
|
|
|
|
If you could buy only one book on building Server Controls in ASP.NET, which book would it be and why?
It seems like I spend the most project time debugging controls and tracing what's going on. I'd like to get a definitive guide to developing server controls so that I can master this and get on with the real work!
TIA for you input.
|
|
|
|
|
If you are doing the ASP.NET 1.1, my recommendation is Nikhil's book[^]. For the version 2.0, I'm not sure if he has a plan for the second edition, but Dino Esposito is the name that I respect most and you might want to check out his book[^] and his crash courses in MSDN[^].
|
|
|
|
|
I'm doing .NET 2.0 these days.
|
|
|
|
|
Any suggestions on which methodlogies we should choose? What is preffered for .NET?
How successfull are Agile and Extreme Programming in real world?
Please suggesst some books and/or online article.
Thanks.
Robert
|
|
|
|
|
I'm using a details view for the first time.
I have a data access layer in my program so I'd like to avoid using the SQLDataSource Object if I can.
I've been trying to do an insert with the details view.
On my details view I have OnItemInserting="DetailsViewSubmit_Insert"
in my code section I have a function:
protected void DetailsViewSubmit_Insert(Object sender, DetailsViewInsertEventArgs e)
From what I'm reading the information the user typed into the text boxes is supposed to be an an Idictionary object at "e.Values"
However when I check e.Values.count its always empty.
Has someone else come across this problem, or perhaps is there a better way to use the details view?
Here's the full details view.
<asp:DetailsView ID="DetailsViewSubmit" runat="server"
Height="50px" Width="125px"
DataKeyNames="FeedbackKey"
DefaultMode="Insert" AutoGenerateRows="False"
OnItemInserting="DetailsViewSubmit_Insert">
<Fields>
<asp:BoundField HeaderText="Subject" DataField="Subject">
<ControlStyle Width="600px" />
</asp:BoundField>
<asp:BoundField HeaderText="Body" DataField="Body">
<ControlStyle Height="250px" Width="600px" />
</asp:BoundField>
<asp:CommandField ShowCancelButton="False" ShowInsertButton="True"
InsertText="Submit" />
</Fields>
</asp:DetailsView>
protected void DetailsViewSubmit_Insert(Object sender, DetailsViewInsertEventArgs e)
{
Response.Write("DetailsViewSubmit called - count = " + e.Values.Count);
}
|
|
|
|
|
The e.Values is only specified when you use the DetailsView control with a datasource control, here you have a data access layer you then may consider using the ObjectDataSource with the control. If you don't specify any datasource control in the DataSourceId property of the DetailsView, you'll need to manually get values from the control and do the insert command. You can read more about how to use the ObjectDataSource and DetailsView control in MSDN.
|
|
|
|