|
I don't know until the page is created how many radiobuttonlists I will need. So, I create them and store the number in a hidden label. But, when I want to get the selection from the radiobuttonlist on postback, I keep getting a object reference error. I've tried finding the control without a findControl, with a findControl and with a master page content reference and findControl. No luck. Any help appreciated...
Dim myConStr As String = ""
If lblSidCount.Text <> "0" Then
Dim x As Integer = 1, y As Integer = Convert.ToInt32(lblSidCount.Text)
Do While x <= y
Dim myContent As ContentPlaceHolder = CType(Page.Master.FindControl("ContentPlaceHolder1"), ContentPlaceHolder)
Dim radConStr As New RadioButtonList
radConStr = CType(myContent.FindControl("rad" & x.ToString), RadioButtonList)
myConStr &= radConStr.SelectedItem.Text & "~"
x = x + 1
Loop
myConStr = Left(myConStr, Len(myConStr) - 1)
End If
|
|
|
|
|
This seems to work - am I crazy for doing this?
Private radCon As RadioButtonList()<br />
Protected Overrides Sub OnInit(ByVal e As EventArgs)<br />
MyBase.OnInit(e)<br />
If (Request("str") = 1) Then<br />
Dim myList As dsSql = New dsSql() ''''instantiate the function to get dataset<br />
Dim ds As New Data.DataSet<br />
ds = myList.dsConSessionTimes(Request("eid"))<br />
If ds.Tables("conSessionTimes").Rows.Count > 0 Then<br />
radCon = New RadioButtonList(ds.Tables("conSessionTimes").Rows.Count - 1) {}<br />
Dim i As Integer = 0<br />
Dim rad As RadioButtonList = New RadioButtonList()<br />
rad.ID = "rad" + i.ToString()<br />
rad.DataSource = ds.Tables("conSessions")<br />
rad.DataTextField = ds.Tables("conSessions").Columns("session_name").ToString<br />
rad.DataBind()<br />
rad.SelectedIndex = 0<br />
phConcurrent.Controls.Add(rad)<br />
radCon(i) = rad<br />
For Each j As Data.DataRow In ds.Tables("conSessionTimes").Rows<br />
Dim rad As RadioButtonList = New RadioButtonList()<br />
rad.ID = "rad" + i.ToString()<br />
rad.DataSource = ds.Tables("conSessions")<br />
rad.DataTextField = ds.Tables("conSessions").Columns("session_name").ToString<br />
rad.DataBind()<br />
rad.SelectedIndex = 0<br />
phConcurrent.Controls.Add(rad)<br />
radCon(i) = rad<br />
i = i + 1<br />
Next<br />
End If<br />
End If<br />
End Sub
|
|
|
|
|
Hi, I am trying to build a website that provides stock information like the one in Yahoo Finance:
http://finance.yahoo.com/echarts?s=MSFT#chart7:symbol=msft;range=3m;indicator=bollinger+volume;charttype=line;crosshair=on;ohlcvalues=0;logscale=on;source=undefined
All the source and analytical data is already there, however I am trying to implement a mechanism that allows users to click and graph additional chart on each mouse click, meaning there'll be multiple postbacks. The problem is with each postback, existing charts plotted by users should remain on the page, and only the new chart is added.
In the link above, if you click on "TECHNICAL INDICATORS", a dropdown list appears allowing users to add additional chart to the page, without destroying existing charts that's currently on the page. This is exactly the kind of function I want to have for my website.
So how could I implement this mechanism using ASP.NET? I am thinking this is a Viewstate issue. Should my goal be maintaining the viewstate of the chart itself? Or should I perhaps store user-defined inputs temporarily into a control (perhaps a label control)and maintain the viewstate of that, based on which the chart will be plotted?
Or is there a more elegant approach to this?
I'd greatly appreciate any suggestions! Thank you.
|
|
|
|
|
Could someone please give me some suggestions if possible? Thanks!
|
|
|
|
|
Try using ajax and avoid postback.
Asp.Net Ajax provides you a number of ways to stay on the page and add
contents to the same page from the server.
Hope this will help.
|
|
|
|
|
Thanks for the reply Anurag. I thought with AJAX, there'll still be postbacks, just partial postback in the AJAX panel? Thus if I put my chart in the panel, it'll still post back and redraw the chart every time I click the "ADD New Chart" button right?
Thanks!
|
|
|
|
|
Hi,
Ajax doesn't always mean UpdatePanel.
When user clicks add new chart, Create a new XmlHttpRequet,
Send the request for the new chart to the server,
Get the new chart as a response from the server,
Then, add it to your page using javascript.
Postback is not needed in this case.
You may need to go through tutorials or book if facing problem.
|
|
|
|
|
Hi All,
Hope everyone had a Merry Xmas and Happy New Year.
Just a question...I have made an RSS Feed which is syndicated by the Mozilla and IE , as an output of an XML file. However when either of the feeds show, they show the pubDate as being totally different dates to what is shown in the XML file. Even when I look at the source, the XML file still shows the correct dates as opposed to what is shown in the browser.
What do you guys think is the problem? Heres my code. Cheers.
public static void CreateNewsFeed(string mappath)
{
FileStream fs = null;
StreamWriter sw = null;
try
{
using (SqlConnection conn = Connection.connect())
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "ShowNewsFeed";
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader reader = cmd.ExecuteReader();
fs = new FileStream(mappath, System.IO.FileMode.Create, System.IO.FileAccess.Write);
sw = new StreamWriter(fs);
sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
//ISO-8859-1
//xmlns:atom=\"http://www.w3.org/2005/Atom\"
sw.WriteLine("<rss version=\"2.0\">");
sw.WriteLine("<channel>");
sw.WriteLine("<title>Company Name</title>");
sw.WriteLine("<link>http://www.companyname.com.au/Home/News/News.aspx</link>");
sw.WriteLine("<description>News and the latest updates</description>");
sw.WriteLine("<language>en-us</language>");
while (reader.Read())
{
DateTime dt = (DateTime)reader["datePosted"];
sw.WriteLine("<item>");
sw.WriteLine("<title>" + reader["title"].ToString() + "</title>");
sw.WriteLine("<link>http://www.companyname.com.au/NewsArticle.aspx?newsID=" + reader["newsID"] + "</link>");
sw.WriteLine("<description>" + reader["description"].ToString() + "</description>");
sw.WriteLine("<pubDate>" + dt.ToString("R") + "</pubDate>");
sw.WriteLine("</item>");
}
sw.WriteLine("</channel>");
sw.WriteLine("</rss>");
sw.Close();
fs.Close();
}
}
catch (Exception m)
{
throw new Exception(m.Message);
}
}
|
|
|
|
|
HELLO All
Recently i found this article about reporting with word document ,when i used the sample code it's working fine ,but rather plain , what if i want spice my report , i have an already designed word reports ,they are simple forms , when i saved them as XML i got this lengthy xml file ,now of course i have some blank cells , in the reports that i want to fill since the report is basically a table , here comes the headache ,HOW TO GET TO THE PARTICULAR NODE? i have solved this problem in a hard way i wonder if there is a better way DOES ANY1 KNOW AN EASIER WAY TO GET TO THE NODES AND OVERWRITE THEM? ANY GOOD ARTICLE ABOUT THIS TOPIC
THANX IN ADVANCE
by the way here is the hard solution of mine ,i first read copy xml file into .txt file then read it and indexof() the cell to know where is it exactly i want to insert my data the code would like like this
fp = File.OpenText("C:\Documents and Settings\Administrator.RFF-SRV0\Desktop\" & "NoteVactionXML.txt")
_ManipulationStr = fp.ReadToEnd()
Dim str, resl As String
resl = _ManipulationStr
Dim index As Integer = 0
str = "<w:r w:rsidrpr="" 00ea5324""="">" _
& "<w:rpr>" _
& "<w:rfonts w:cs="" simplified="" arabic""="">" _
& "<w:b>" _
& "<w:bcs>" _
& "" _
& "<w:t>" & "خن" & "" _
& ""
resl = resl.Insert(548 + 10566, str)
fp.Close()
strHTMLContent.Append(resl)
HttpContext.Current.Response.Write(strHTMLContent)
HttpContext.Current.Response.End()
HttpContext.Current.Response.Flush()
Do i have to do the above for each item?
I HOPE NOT
|
|
|
|
|
you are a very bold person
I am assuming you have an xml-document :
.Net has some classes you want : XmlReader and XmlDocument .
A search for those terms should give you plenty articles to read.
|
|
|
|
|
how creat word document in asp.net use by vb.net
|
|
|
|
|
Hi ,
Is there any Javascript/Jquery slider control for selecting a range of dates ?.Could you please let me know ?
With Warm regards..
|
|
|
|
|
|
I have a button and a repeater, its datasource is a list of strings. When I click on the button, a new item is added to the repeater's datasource and the page refreshes, but I can't see the change in the repeater till I refresh the page again. What should I do in order to see the changes immediatly?
|
|
|
|
|
Make sure you are rebinding the repeater control during postback. If you are doing this please show us the code.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
i want to allow the user to enter apostrophe in the name entered in the text box.. it cant be given as e.KeyChar == '''. can somebody help me i am new to this..
|
|
|
|
|
Currently, how are you validating your textbox?
|
|
|
|
|
i have just started when i was writing the code it showed me this error
|
|
|
|
|
\' maybe.
Why not use regular expression and do the validation in javascript?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
steps for how to pass parameters to crystal reports throug textbox or dropdownlist using asp.net with c#.net
in design time text box is not available in tool box how to take textbox or dropdownlist
|
|
|
|
|
Did you tried the solution given in your last post?
Are you facing any problem with that?
Search google, you'll find many examples of parameter passing to crystal reports.
|
|
|
|
|
in the tool box there is no textbox, dropdownlist controls then how to take values from these controls
|
|
|
|
|
I am using SQL SERVER to create a database, but I can not find the files in my PC.
if open it from SQL SERVER MANAGEMENT, it is shown as my-PC\SQLEXPRESS\database\system datatase\master\tables\dbo.TEST
actually TEST is one table I CREATEED. but I CAN NOT FIND IT IN THE EXPLORER.
who can tell me where is it located then?
thanks.
|
|
|
|
|
First and foremost. Never add tables to the master database. Create a new database and add it there. For express the default data location is usually C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data. Also, you cannot see specific tables in Windows Explorer, only the databases.
|
|
|
|
|
I'm using the full version so there may be some differences in Express (I'm not familiar with that product). That said, one way to determine where your .mdf / .ldf files for your db are located is to script the database. Right click on the database you've created, select Script Database As from the popup menu.
You may have to follow slightly different steps in Express, but the general idea here is to generate a CREATE DATABASE script. Having done so, you'll notice something along these lines:
CREATE DATABASE [YourDbName] ON PRIMARY
( NAME = N'YourDbName', FILENAME = N'C:\Whatever\The\Path\Is\YourDbName.mdf' , SIZE = 45056KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )...
There's more to the script of course, but the FILENAME portion will show you exactly where the db file lives. Sql Server uses .mdf files for the database, and .ldf for the log. If you want to move it to a new directory, be sure to move both files.
Hope this helps -
|
|
|
|