|
I have to open a new window using code behind(VB)..I tried
strJScript = "<script language=javascript>"
strJScript += "window.open('cuponprint.aspx',null,'height=150, width=430,status= no, resizable= yes, scrollbars=yes, toolbar=no,location=center,menubar=no, top=100, left=300');"
strJScript += "</script>"
Response.Write(strJScript)
But dis open s popup which can not be seeen when popup blocker is activated..
Is there any way to open a new window instead of a popup even when popup blocker is active..
Regards.
|
|
|
|
|
Well that would defeat the purpose of having a pop-up blocker...if you wish to by-pass a popup blocker means that you are trying to identify a hole in the browser security...
I think you cannot do that ...even if you do it by any trick that would be patched up anyway by the browser makers...
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
|
|
|
|
|
Yes.. he is right, rather what you can do is to write the content of the page into a hidden div that acts similar to popup, and show that div.
Abhishek Sur
|
|
|
|
|
|
You have some serious formatting issues. I don't even know what is going on there... Can you reformat the post?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Firstly we dont work for you and we dont do School homeworks here for people.
Secondly never use words like "As Soon as Possible" we dont work for you and you dont respect us.
Lastly Formating your code at code Project is easy, just add your code between the pre tag like this
if(Retard)
{
lblmessage.text = "Get Manners, its free :)";
}
else
{
lblmessage.text ="lol!!!!!!!!";
}
And try posting your code again.
Hope it helps
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
Hi ladies and gentlemen,
I'm trying to retrieve sql statement to datatable then update to gridview.The datareader can read it.
and able to retrieve data to txtDistID(from sql) and lblTotal(total count from datatable).
But the gridview cannot show the retrieved value from datareader. but no error message found...
Did i miss out anything?
Can you please guide me?
Thanks and appreciate......
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
eConn = System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString").ToString()
Dim cn As New SqlConnection(eConn)
Dim cmd As New SqlCommand
cn.Open()
strQuery = "SELECT DistID,EmpNo,EmpName,ICNo from udtDistributionAdd order by EmpNo"
cmd.CommandText = strQuery
cmd.Connection = cn
dr = cmd.ExecuteReader()
InitMyTable()
Do While dr.Read
Row = myTable.NewRow()
Row.Item("EmpNo") = dr(1).ToString()
Row.Item("EmpName") = dr(2).ToString()
Row.Item("ICNo") = dr(3).ToString()
Me.txtDistID.Text = dr(0).ToString()
myTable.Rows.Add(Row)
Loop
Me.lblTotal.Text = myTable.Rows.Count
cn.Close()
dr.Close()
End Sub
Public Sub InitMyTable()
myTable = New DataTable("Search")
Dim EmpNo As DataColumn = New DataColumn("EmpNo")
EmpNo.DataType = System.Type.GetType("System.Int32")
myTable.Columns.Add(EmpNo)
Dim EmpName As DataColumn = New DataColumn("EmpName")
EmpName.DataType = System.Type.GetType("System.String")
myTable.Columns.Add(EmpName)
Dim ICNo As DataColumn = New DataColumn("ICNo")
ICNo.DataType = System.Type.GetType("System.String")
myTable.Columns.Add(ICNo)
Dim ds As New DataSet
ds = New DataSet
ds.Tables.Add(myTable)
Me.gvSearch.DataSource = myTable
Me.gvSearch.DataBind()
End Sub
|
|
|
|
|
Have you stepped through the code and confirmed the data is in the table, it's not empty ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi Christian Graus,
Yes i confirmed that the data is in the table. I tried to put few labels to retrieve the data. (eg:Me.lblEmpNo.Text = dr(1).ToString())
during looping, i can get the correct retrieved result.
But it cannot be updated into the gridview after done....
Do i need to write code to update the data from datatable to gridview?
How should i solve this problem?
Pls help....
Thanks in advanced....
|
|
|
|
|
what does your aspx look like ? If you put in a template for an empty data set, does it show instead of your data ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
below is my gridview setting.. i put the gridview in a div.
I tried to create new gridview outside the div also not able to retrieve.
and i tried to retrieve to formview also cannot.
Pls help me......
Thank you very much.......
<asp:content id="Content1" contentplaceholderid="ContentPlaceHolder1" runat="Server" xmlns:asp="#unknown">
<asp:gridview id="gvSearch" runat="server" allowsorting="True" autogeneratecolumns="False" backcolor="#DEBA84" bordercolor="#DEBA84" borderstyle="None" borderwidth="1px">
CellPadding="3" CellSpacing="2" Font-Size="Small">
<footerstyle backcolor="#F7DFB5" forecolor="#8C4510">
<pagersettings mode="NumericFirstLast">
<rowstyle backcolor="#FFF7E7" forecolor="#8C4510">
<selectedrowstyle backcolor="#804040" font-bold="True" forecolor="White">
<headerstyle backcolor="#A55129" font-bold="True" forecolor="White">
<asp:content>
|
|
|
|
|
Eunice (VB junior) wrote: autogeneratecolumns="False"
OK - so where is the code to define the columns ? Did you try a style for the empty grid ? Did you look at the html to see if the div is visible ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
The div is visible.I didn't try the empty grid as I'm not too sure how to do it. sorry coz I'm still new to asp.net.
I declare the columns at InitMyTable...
Sub InitMyTable()
myTable = New DataTable("Search")
Dim EmpNo As DataColumn = New DataColumn("EmpNo")
EmpNo.DataType = System.Type.GetType("System.Int32")
myTable.Columns.Add(EmpNo)
Dim EmpName As DataColumn = New DataColumn("EmpName")
EmpName.DataType = System.Type.GetType("System.String")
myTable.Columns.Add(EmpName)
Dim ICNo As DataColumn = New DataColumn("ICNo")
ICNo.DataType = System.Type.GetType("System.String")
myTable.Columns.Add(ICNo)
Dim CostCenter As DataColumn = New DataColumn("CostCenter")
CostCenter.DataType = System.Type.GetType("System.String")
myTable.Columns.Add(CostCenter)
Dim Division As DataColumn = New DataColumn("Division")
Division.DataType = System.Type.GetType("System.String")
myTable.Columns.Add(Division)
Dim ds As New DataSet
ds = New DataSet
ds.Tables.Add(myTable)
Me.gvSearch.DataSource = myTable
Me.gvSearch.DataBind()
End Sub
i found one vb code but it's in window application (not asp.net)...
it has this extra line :- datagrid1.Update() after the datareader looping...
But i'm not too sure how to convert it into asp.net
in asp.net, it only has gvSearch.UpdateRow(). But it cannot recognized as well.
Please help.... Sorry to trouble you....
Thanks in advanced....
|
|
|
|
|
Remove the line that says 'autogeneratecolumns="false". Set it to true. I am sure your issue is that you are not defining any columns.
And, you need to buy a book on ASP.NET and work through it, unless you're just coding for fun. If someone is paying you, you should be ashamed. If you want to get paid at some point, buy a book and work through these basics.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi Christian Graus,
Thank you so much of ur help.. It works brilliant by now...
thanks for ur advice as well..
|
|
|
|
|
OK - the lesson is to turn autogeneration on, or to actually define some columns in the ASPX. Your code behind code was obviously not doing that, and it's messy anyhow, the aspx is the right place to define the columns of the grid.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks,I understand now... Chris,you are a good 'teacher'.
|
|
|
|
|
Hi! Is there an example on how I can hover the mouse over listbox item (image names) and show the image? Thanks!....Also my images are from Database...
|
|
|
|
|
Try this[^]
Be careful, there is no Undo Button(Ctrl+Z) in life.
|
|
|
|
|
Hi folks,
I have add a dropdownlist into my datagridview. This dropdown list consists two unbound value (item1= 'YES' and item2= 'NO')
How can I update my datagridview data by using update button. Any idea?
error message is:
"DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items"
|
|
|
|
|
Try to create a list of items, hard coded ( just a List<string> will do ), and then bind to that.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks for your reply..
I have added the following code and no change occured:
<asp:TemplateField HeaderText="EAN" SortExpression="EAN">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" DataTextField="EAN" DataValueField="EAN" >
<asp:ListItem Text="YES" Value="YES" />
<asp:ListItem Text="NO" Value="NO" />
</asp:DropDownList>
</EditItemTemplate>
|
|
|
|
|
Hello,
Thank you for your reply. I have added the following code but nothing changed:
<asp:TemplateField HeaderText="EAN" SortExpression="EAN">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" DataTextField="EAN" DataValueField="EAN" >
<asp:ListItem Text="YES" Value="YES" />
<asp:ListItem Text="NO" Value="NO" />
</asp:DropDownList>
</EditItemTemplate>
|
|
|
|
|
Hello,
I have declared an image control. I'm trying to display a picture from my db using linq.
The code:
protected void Button1_Click(object sender, EventArgs e)
{
DataClassesDataContext db = new DataClassesDataContext();
test1 x2 = db.test1s.First(p => p.descriere.StartsWith("xxx"));
byte[] img = (x2.img);
MemoryStream ms = new MemoryStream(img);
System.Drawing.Image Image1 = System.Drawing.Image.FromStream(ms);
}
where test1 is a table with 3 fields- id-int/descriere char/img image. Do i need more code for the picture to show? or what is the problem?
|
|
|
|
|
You're using LINQ, but you don't know how a website displays images ?
You need to provide a URL to an image, or a URL to a page that streams back these bytes. I don't see any code here that even attempts to display your image.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|