|
You'll need to show more code than that - post the declaration of the SQL DS and of the grid, so we can see if they tie up ok - my bet would be that you've not bound the grid correctly, or AutogenerateColumns=false and no cols specified?
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
FRIENDS,
THERE IS NO TREE CONTROL IN ASP.NET1.1 .CAN SOMEBODY TELL ME ANY ALTERNATIVE FOR DESIGNING THE TREEVIEW IN ASP.NET 1.1 IN VB.NET 1.1
|
|
|
|
|
|
I have created a resource file using resource writer .Now after some time i want to change the value for a key at runtime how do i do it i.e after complilation
|
|
|
|
|
Hi all,
I am tring to print information present on webpage.
I am using Javascript for this purpose.
function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML=strOldOne;
}
//html Page
<asp:datagrid....>
....
<asp:imagebutton id="imgPrint" runat="server" imageurl="~/App_Themes/Default/Images/ico_16_126.gif">
///on page lod
imgPrint.Attributes.Add("onclick", "CallPrint('innerPage');")
//on image button click
Dim popupScript As String = "CallPrint('innerPage') ;"
Page.RegisterStartupScript("PopupScript", popupScript)
But this gives error
'DialogArguments_IE_PrintType' is Null or not an object.
If Any one knows something...let's share with me.
thanks,
Nagraj
|
|
|
|
|
Hello Everyone,
I'm Munjal from India. I know how to manage a session with the help of 'Session' in ASP.Net but how can we manage a session for a particular user logged in with the help of 'Cookie Authentication'. Can u send me the code
Munjal
|
|
|
|
|
Hi,
I have 2 applications (apps1 and apps2) both using windows authentication.I have another main application called Login thru which i can log into the above 2 applications and this also uses windows authentication.
I would like to pass the session variables from the login apps to apps1 and apps2 with out gettting the login page to enter the values. Also apps1 and apps2 can be run individually without going through the login page.
Sessions donot work. Is there anyway to do this???
Any code or tutorial for the same will be useful
Regards
|
|
|
|
|
|
I need to dynamically instantiate an object using a string parameter, but don't know how to have the string evaluate as the name of an object... e.g.,
<br />
public class myClass <br />
{<br />
public Class_Master objMaster = new Class_Master();<br />
public Class_A objA = new Class_A();
public Class_B objB = new Class_B();
public Class_C objC = new Class_C();
<br />
public myClass(string nameOfTemplateClass)<br />
{<br />
this.objMaster.ContentTemplate = nameOfTemplateClass;<br />
}<br />
<br />
}<br />
So I then instantiate myClass specifying one of the ITemplates as my parameter:
myClass xyz = new myClass("objB");
"objB" is interpreted (understandably) as a string, not the object I wish to reference. Is there a method for evaluating a string literally? Like:
this.objMaster.ContentTemplate = eval(nameOfTemplateClass);
|
|
|
|
|
Why not use a switch/if-structure to instantiate the class you need based on the string?
---------------------------
127.0.0.1 - Sweet 127.0.0.1
|
|
|
|
|
That is in fact what I ended up doing as a workaround. However, I'm still interested in whether this is possible, as I encounter this situation periodically. I have used FindControl("stringname") for the times when I'm specifying a control, but there are times when evaluating a string as code might be useful; perhaps even composing an entire statement dynamically... but thank-you for responding with a workaround suggestion.
|
|
|
|
|
Hi ,
please i learnt something called VIEWSTATE & i didn't understand it well
what i want to know is what is the role of that viewstate ?? why we use it ? & when ?
thank you
try to be good if you can't be the best
|
|
|
|
|
Hi,
When a control is created dynamically at run time, some information about the control is stored in the view state that is rendered with the page. When the page is posted back to the server, however, non-dynamic controls (those defined on the page) are instantiated in the Page.Init event and view state information is loaded before the dynamic controls can be recreated (generally in the Page_Load handler). Effectively, before the dynamic controls are recreated, view state is temporarily out of sync with the page's controls. After the Page_Load event has run, but before control event handling methods are called, the remaining view state information is loaded into the dynamically created controls.
In most scenarios, this view state processing model works fine. Typically, you add dynamic controls to the end of a container's collection of controls. The view state information stored for the dynamic controls is therefore extra information at the end of the view state structure for the appropriate container, and the page can ignore it until after the controls are created.
However, view state information about dynamically created controls can be a problem in two scenarios:
If you insert dynamic controls between existing controls.
If you insert controls dynamically and then reinsert them during a round trip, but with different values.
If you insert dynamic controls between existing controls, the dynamic control's view state information is inserted into the corresponding location of the view state structure. When the page is posted and the view state is loaded, the dynamic control does not yet exist; therefore, the extra information in view state does not correspond to the right control. The result is usually an error indicating an invalid cast.
Hope u understood the y we require ViewState.
|
|
|
|
|
thank you man thank you very much , i just didn't understand what you mean by dynamic controls & non-dynamic ones
well i think i have more to learn before learning abt view states
try to be good if you can't be the best
|
|
|
|
|
Hi,
U can just go to the link and read I hope this will surly help u as I read this to understood Viewstate.I new to .NET but it helped me a lot.
http://www.dotnetjohn.com/PrintFriend.aspx?articleid=71
Regards.
|
|
|
|
|
thank you
try to be good if you can't be the best
|
|
|
|
|
I'm using the REPLACE property of the stringbuilder class to change the font size within a "FONT" tag, however the string that I'm referencing contains apostrophes around the number, which obviously causes problems.
Here's my code:
-----------------------------------------
Dim strHTML As System.Text.StringBuilder = New System.Text.StringBuilder()
strHTML.Replace("<font size="3">", "<font size="20">")
-------------------------------------------
What can I do so that I can still replace the "3" with a "20" without causing the program to crash due to the apostrophes?
Thanks in advance.
-Goalie35
-- modified at 17:31 Monday 19th June, 2006
|
|
|
|
|
You need to escape the double quote with a backslash.
strHTML.Replace("", "")
|
|
|
|
|
Use double quotes to put a quote in a string:
strHTML.Replace("<font size=""3"">", "<font size=""20"">")
---
b { font-weight: normal; }
|
|
|
|
|
Hello All,
I have a datagrid control on webpart, in which I am displaying two out of six columns from a dataset. When somebody click on one row, I want to display all six values for that row on the same webpart without postback. i made this datagrid clickable. i m passing value using the following code.
public void dgSpeakerEvents_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.DataItem!=null)
{
e.Item.Attributes.Add("onmouseover","this.style.cursor='hand'");
e.Item.Attributes.Add("onclick","ShowDetails('"+
DataBinder.Eval(e.Item.DataItem, "TOPIC_NM").ToString()+ "','"+
DataBinder.Eval(e.Item.DataItem, "CITY").ToString()+ "','"+
DataBinder.Eval(e.Item.DataItem, "STATE").ToString()+ "');");
//e.Item.Attributes.Add("onmouseout", "HideTooltip();");
}
}
but when i clicked on datagrid, it shows an error: object expected. i checked in the html source code generated by the browser, values passing correctly.
my javascript function is :
function detail()
{
function ShowTooltip(name,city,state)
{
document.getElementById('td0').innerText=name;
document.getElementById('td1').innerText=city;
document.getElementById('td2').innerText=state;
X=event.clientX+document.body.scrollLeft;
Y= event.clientY + document.body.scrollTop + 10;
Popup.style.display='block';
Popup.style.left = X;
Popup.style.top = Y;
}
}
function HideTooltip()
{
Popup.style.display='none';
}
If any body can suggest me with good example.Thanks.
Dhruvil
-- modified at 16:53 Monday 19th June, 2006
|
|
|
|
|
Hi
Sorry to bother you guys but this is driving me nuts. I'm trying to retrieve a list of email addresses from a database, and send an email to all those addresses. For testing purposes, the database contains 1 address, mine. Code below (with senstivie bits *** out)
Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click
If Page.IsValid Then
Dim strSQL As String
Dim MyConn As Data.SqlClient.SqlConnection
MyConn = New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
Dim strBody As String
Dim Msg As New System.Net.Mail.MailMessage
Dim MailObj As New System.Net.Mail.SmtpClient()
'retrieve list of email address,IDs etc
strSQL = "Select * From vwNewsLetterList"
Dim objDR As Data.SqlClient.SqlDataReader
Dim Cmd As New Data.SqlClient.SqlCommand(strSQL, MyConn)
MyConn.Open()
objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
'loop thru data, construct the message and send it
While objDR.Read()
strBody = txtMessage.Text
Msg.IsBodyHtml = True
Msg.Subject = "Test email"
MailObj.Host = "mail.*****.net"
Msg.From = New System.Net.Mail.MailAddress("*@*.net")
Msg.To.Add(New System.Net.Mail.MailAddress(objDR("Email")))
Msg.Body = strBody
MailObj.Send(Msg)
End While
MyConn.Close()
End If
End Sub
The code excutes with no errors, but... immediately afterwards I see my virus scanner going, and when I check my mail I get an "Undelivered Mail Returned to Sender" message from my virus checker, with the following info:
I'm sorry to have to inform you that the message returned
below could not be delivered to one or more destinations.
-------------------------------------------------------------------
*******@*****.com: sorry, that domain isn't allowed to be relayed thru this MTA (#5.7.1)
-------------------------------------------------------------------
Your e-mail message is being returned to you in the next part of this
message. Try to send the message again.
It seems as if the code is trying to send the message through my personal email server rather than the smpt client specified in the code. What am I doing wrong? Oh, and by the way... if I use "traditonal" ASP and specifiy this Smtp client, it works perfectly.
|
|
|
|
|
try this
Try
Dim smtpserver As Web.Mail.SmtpMail
Dim mesg As New Web.Mail.MailMessage
smtpserver.SmtpServer=strsmtpserver
mesg.From = mailFrom
mesg.To = mailto
mesg.Subject = subj
mesg.Body = messg
smtpserver.Send(mesg)
i = "Mail Sent"
Catch
i = "Failed to send Mail"
End Try
Remember that ur mail id should be a part of the smtp server e.g if ur id is xzy@yahoo.com then smtp server should be of yahoo else u will get the relay error message
|
|
|
|
|
OK, it's sorted - and I didn't have to change any of the code. It turns out my webhost wants the SMTP server bit called "localhost". Thats all that was required. Thank you for the reply though, smita_roy.
|
|
|
|
|
hey ,
well i'm a beginner in ASP.Net & i've leanrt something abt the latest ASP.Net 2.0 & i wanna walk to be an expert one day
i just tried to build ma first web page that enter to the database but i had a problem
ma web page doesn't shown , i see in the browser an other page that tells me that i can't open this database because it is already opened & stuffs & it gives me thecode i wrote in the maapp.aspx.vb & it stops in the first line
Connection.Open
i hope you understood me i really need that help i wanna make it work thank you very much
try to be good if you can't be the best
|
|
|
|
|
most likely you have a invalid connection string to your database. make sure your premissions to the db are set correctly.
|
|
|
|