|
Can you let me know abt that command argument?...
|
|
|
|
|
suppose you are having an image button whose click event you are trying to capture in itemcommand event, then that image button will be having a property called command argument which you can set in the item bound event of the datagrid. And in itemcommand event you can access that command argument property, it will give you the corresponding value of that row.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi Apurva.,
I am newer. i want toretrieve that imagebutton's imageurl wheich is in the datagrid.
I can retrieve that value only in databound event using datarowview...
I want to pass this value to next page...
In item command event only i can use response.redirect... with the query string..
I tried as u say, commandargument in itemcommand event it shows only the null value..,
If possible send me the sample coding...,
And also for the Paging in datalist also...
Thanks & Regards!..
T.Prabu
|
|
|
|
|
suppose you are having an image button in a template column of datagrid, then this code you have to put in your onitembound event:
<br />
ImageButton ii = (ImageButton)e.Item.FindControl("imgbtn");<br />
ii.CommandArgument=drv[0].ToString();
here drv[0] is datarowview and the value which you need to put.
And in itemcommand event you can retrieve that value like this:
string str = e.CommandArgument.ToString();
Prabs frm PGP wrote: And also for the Paging in datalist also...
For custom paging you can get so much of article on net. you just need to search through google.
Best Regards,
Apurva Kaushal
|
|
|
|
|
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[^].
|
|
|
|