|
hi ,
I have created a data grid and also connected to database ( in sql server) . my data grid table consists of few rows and columns . my each row shud be updated by modfying the row creating a edit box there in the page displayed when u click the edit button!! i want to edit each row and then update existing record of the table ..
i am working in VS 2005 and using sql server manager for my database ..
can somebody explain me each step clearly how to do this !!!
thank you
|
|
|
|
|
1. Convert all bounded columns to the template columns.
2. Add a Link and set the commandname "Edit" in normal template..
3. Add another link in edit template and set the commandname "update"
4. In Datagrid_ItemCommand event,
<br />
if(commandname = "edit"){<br />
}<br />
else if(commandname = "update"){<br />
}
That's all..
|
|
|
|
|
can u explain in detail how to do that.. i am not able to do it still
|
|
|
|
|
Those steps that I mentioned are the details.. I currently don't have the sample code for this..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
VS 2005 Pro SP1 on Win XP.
I get the above error occasionally on attempting to save a web form. Clicking on OK triggers the Save As dialog box. At this point the only solution is to save it to another location, then quit VS, copy the saved file back to its original location (i.e., overwrite the corrupted original) and then restart VS.
I've seen that others have had this problem but on older versions of VS. So far, I've only noticed it happening on the same specific file. This is a file I've inherited from another developer and contains user controls and Ajax controls.
I also have these IDE add-ins - Refactor! Pro/DXCore, GhostDoc, SmartPaster, CodeKeep, Resharper UnitRun.
Any ideas?
Kevin
|
|
|
|
|
I have a search option in my page how can I control the words that are in the list when the user types something.
I have different pages I need to get the relevant words to this page.
thx
BiG RaLpH
|
|
|
|
|
|
I need several buttons on each GridView row that redirect to pages performing custom operations. How do I get the DataKey of the row the button was clicked on? So that I can send the database ID of the row I want to perform operations on to another page. I can't use GridView.SelectedDataKey.Value because i'm not always going to be clicking the select button. Nor can I use the index, because that is not the ID for the data in the database.
|
|
|
|
|
Nevermind. This is how I did it. If someone knows a better way, lemme know.
I created a button commandField with command "EditRow" and hooked up the RowCommand event.
<code>
protected void MainGrid_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "EditRow")
{
DataKey mykey = MainGrid.DataKeys[Convert.ToInt32(e.CommandArgument)];
String mystring = Convert.ToString(mykey.Value);
Page.Response.Redirect("Insert.aspx?key=" + mystring);
}
}
</code>
|
|
|
|
|
I m in need of list of asp.net project title for my academic , can any one help me.
prabumj@gmail.com
|
|
|
|
|
How's about a project title cataloguing and listing application?
|
|
|
|
|
I See two problem.
1st: Wrong forum, try Longue
2snd: You didn't say witch language you gonna use.
My Suggestion:
If you must have asp.net, then try Database manager or news control.
|
|
|
|
|
I have added the script below to my website and if it is in test mode, it works fine - it writes the data to the screen. But when I take it out of test mode, it doesn't email me the data. I have pasted the script along with my code for the form. Can someone please tell me why it's not emailing? (Also, fyi, I do have a .txt file setup for the formatting of the email.) Thank you!
ASP Script named sendmail_cdo.asp
<%
option explicit
'---------------------------------------------------------------------------------------------------
'FORM MAIL SCRIPT
'----------------
'usage:
'<form ACTION="sendmail.asp" ...>
'
'hidden fields:
' redirect - the url to redirect to when the mail has been sent (REQUIRED)
' mailto - the email address of the recipient (separate multiple recipients with commas) (REQUIRED)
' cc - the email address of the cc recipient (separate multiple recipients with commas) (OPTIONAL)
' bcc - the email address of the bcc recipient (separate multiple recipients with commas) (OPTIONAL)
' mailfrom - the email address of the sender (REQUIRED)
' subject - the subject line of the email (REQUIRED)
' message - the message to include in the email above the field values. not used when a template is being used. (OPTIONAL)
' template - specifies a text or html file to use as the email template, relative to the location of the sendmail script. (e.g. ../email.txt)
' A template should reference form fields like this: [$Field Name$]
' html - if this has the value "yes", the email will be sent as an html email. only used if a template is supplied.
' testmode - if this is set to "yes", the email contents will be written to the screen instead of being emailed.
'---------------------------------------------------------------------------------------------------
dim pde : set pde = createobject("scripting.dictionary")
'---------------------------------------------------------------------------------------------------
'PREDEFINED ADDRESSES for the "mailto" hidden field
'if you don't want to reveal email addresses in hidden fields, use a token word instead and specify
'below which email address it applies to. e.g. <input type="hidden" name="mailto" value="%stratdepartment%">
'ALSO, in the same way, you can use %mailfrom% to hide the originating email address
pde.add "%contactform%", "myemail@someaddress.com"
pde.add "%salesenquiry%", "anotheremail@someaddress.com"
'---------------------------------------------------------------------------------------------------
function getTextFromFile(path)
dim fso, f, txt
set fso = createobject("Scripting.FileSystemObject")
if not fso.fileexists(path) then
getTextFromFile = ""
exit function
end if
set f = fso.opentextfile(path,1)
if f.atendofstream then txt = "" else txt = f.readall
f.close
set f = nothing
set fso = nothing
getTextFromFile = txt
end function
dim redir, mailto, mailfrom, subject, item, body, cc, bcc, message, html, template, usetemplate, testmode
redir = request.form("redirect")
mailto = request.form("mailto")
if pde.exists(mailto) then mailto = pde(mailto)
cc = request.form("cc")
bcc = request.form("bcc")
mailfrom = request.form("mailfrom")
if mailfrom = "" then mailfrom = pde("%mailfrom%")
subject = request.form("subject")
message = request.form("message")
template = request.form("template")
testmode = lcase(request.form("testmode"))="yes"
if len(template) > 0 then template = getTextFromFile(server.mappath(template))
if len(template) > 0 then usetemplate = true else usetemplate = false
dim msg : set msg = server.createobject("CDO.Message")
msg.subject = subject
msg.to = mailto
msg.from = mailfrom
if len(cc) > 0 then msg.cc = cc
if len(bcc) > 0 then msg.bcc = bcc
if not usetemplate then
body = body & message & vbcrlf & vbcrlf
else
body = template
end if
for each item in request.form
select case item
case "redirect", "mailto", "cc", "bcc", "subject", "message", "template", "html", "testmode"
case else
if not usetemplate then
if item <> "mailfrom" then body = body & item & ": " & request.form(item) & vbcrlf & vbcrlf
else
body = replace(body, "[$" & item & "$]", replace(request.form(item),vbcrlf,"<br>"))
end if
end select
next
if usetemplate then 'remove any leftover placeholders
dim rx : set rx = new regexp
rx.pattern = "\[\$.*\$\]"
rx.global = true
body = rx.replace(body, "")
end if
if usetemplate and lcase(request.form("html")) = "yes" then
msg.htmlbody = body
else
msg.textbody = body
end if
if testmode then
if lcase(request.form("html")) = "yes" then
response.write "<pre>" & vbcrlf
response.write "Mail to:" & mailto & vbcrlf
response.write "Mail from:" & mailfrom & vbcrlf
if len(cc) > 0 then response.write "Cc:" & cc & vbcrlf
if len(bcc) > 0 then response.write "Bcc:" & bcc & vbcrlf
response.write "Subject:" & subject & vbcrlf & string(80,"-") & "</pre>"
response.write body
else
response.write "<html><head><title>Sendmail.asp Test Mode</title></head><body><pre>" & vbcrlf
response.write "Mail to: " & mailto & vbcrlf
response.write "Mail from: " & mailfrom & vbcrlf
if len(cc) > 0 then response.write "Cc: " & cc & vbcrlf
if len(bcc) > 0 then response.write "Bcc: " & bcc & vbcrlf
response.write "Subject: " & subject & vbcrlf & vbcrlf
response.write string(80,"-") & vbcrlf & vbcrlf & "<span style=""color:blue;"">"
response.write body & "</span>" & vbcrlf & vbcrlf
response.write string(80,"-") & vbcrlf & "**END OF EMAIL**</pre></body></html>"
end if
else
msg.send
response.redirect redir
end if
set msg = nothing
%>
Form page...
<form name="form1" method="post" action="sendmail_cdo.asp">
<div align="left">
<p class="style3">
<input name="redirect" type="hidden" id="redirect" value="surveycomplete.htm">
<input name="mailto" type="hidden" id="mailto" value="melissawaldrop@comcast.net" />
<input name="subject" type="hidden" id="subject" value="New Inquiry">
<input name="template" type="hidden" id="template" value="contactform.txt">
<input name="testmode" type="hidden" id="testmode" value="no">
</p>
<p class="style3">First Name
<input name="FName" type="text" id="FName">
Last Name
<input name="LName" type="text" id="LName">
</p>
<p class="style20"><span class="style3"><span class="style31">Email</span>
<input name="Email" type="text" id="Email">
<span class="style31">Phone </span>
<input name="Phone" type="text" id="Phone">
</span> </p>
<p>
<input type="submit" name="Submit" value="Send">
</p>
</div>
</form>
|
|
|
|
|
This is the ASP.NET forum. You should post your question in the Web Development forum.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I am getting the error:
The process cannot access the file 'D:\KBF\WebSite\Project\KBF20071109\Images\Icon_Restricted.gif' because it is being used by another process
while trying to replace it with a new one. The reason is because it is currently displayed in an Asp:Image control. I want to replace it while it is being displaed. I tried to replace it in a button's click event just after reseting the Image control's path in the same event but the same error.
|
|
|
|
|
Hello
I can't send email.
What is smtp server? What is host name?
I know my mail server ip, my email's user and pass.
Now how can i send mail to users and get their feedback.
I test many states but i failed...
Example::
My Email : info@mysite.com
Target User : user@yahoo.com
My Server : www.mellihost.com
Server Ip : 70.84.176.94
Now please help me.
Regards
|
|
|
|
|
You can ask your hosting company about the address of smtp srv.. normally, it works with localhost..
|
|
|
|
|
Ok, But my host couldn't help me well.
Can you send some code using my sample options to help me?
Tanks
|
|
|
|
|
|
Hello
Dear Michael
I'm a professional desktop developer (C# base), but in sending mail, i really confused.
I developed a website for somebody and i'm in final step.
As you said and in this way anybody can send email from anybody to anybody..!
I want to say that: Do i need username, password and real host name or not?
I tested this code and i saw no mail in my inbox. Please notice that i made no change on your code.
So please help me again if you have time.
Tanx
|
|
|
|
|
Hi,
freshonlineMax wrote: Do i need username, password and real host name or not?
You need to define the host name, the SMTP server.... In ASP.NET, you can use either System.Web.Mail or System.Net.Mail for sending emails.. but defining the SMTP server is a must in ASP.NET...
The name of SmtpServer are vary from one host to another.. When I was hosting my site in DisccountASP.NET, I can use "localhost" as the SmtpServer... here is the article from DiscountASP.NET Knowledge Base.
|
|
|
|
|
freshonlineMax wrote: What is smtp server? What is host name?
Your web host is the best contact to give you the optimal values for these queries for your domain.
Vasudevan Deepak Kumar
Personal Homepage
Tech Gossips
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Hi All
I have an ASP.Net TreeView with checkboxes, so I am looking for a code that will UNCHECK all checked checkboxes on a click of a button.
Thank you in advanced.
khuzym
|
|
|
|
|
|
I'm using a CAPTCHA image generator from Code Project and would like to wrap this in to a web control.
So I was wondering what's the best way to display a dynamic image from a memorystream? Currently I'm setting the img src to a handler which works fine. But the handler needs to be a servable page and can't be wrapped in to a control dll. I'd prefer not to write the image to a temp directory. Is there an alternative or a nifty trick like putting the handler in as a resource in the dll?
|
|
|
|