|
|
I have a textbox, that records the file names of upload files, and seperates it out with a , I would like to create an array that would read this text box, and seperate it out, so I can create a link for each file. I could really use some examples in code. My codebehind is C#
|
|
|
|
|
string[] FileNames = txtFileNames.Text.Split(',');
|
|
|
|
|
So then it will string as them as? like how do I assign each portion of the string a varible? Or am I not getting something as simple? Trying to figure out how I would link them.
|
|
|
|
|
Something like this no?
string FileNames[1]=dr["HyperLink1"].ToString();
|
|
|
|
|
Put a placeholder control in the screen, read the filenames and dynamically add link buttons and the click event for each of the links.
|
|
|
|
|
If I understood any of this, I imagine I'd be in good shape. Pardon me, I've only been using .net for about 3 months before, that had never developed anything, and was given a full blown, huge ass project by my work, they know I can't code C# and I am still learning, they just elinated my job... I hate to be a pain in the ass, but could you explain a little further?
|
|
|
|
|
Have a look at this article[^] on codeproject, it shows you how to create dynamic controls. This msdn[^] shows you how to add controls to a place holder.
In the click event of the button, split the filenames into an array, for every item in the array create a linkbutton with a click event and add it to the placeholder
ex:
LinkButton link;
for(int i = 0; i <= FileNames.Length-1 ; i++)
{
link = new LinkButton();
link.ID = "link"+i.ToString();
link.Text = "http://www.yoursite.com/uploadedfile/"+ FileNames[i];
link.Click += new EventHandler(link_Click);
PlaceHolder1.Controls.Add(link);
}
Instead of the linkbutton you can also use the label control and set the text of the label control as Label1.Text = a href to pass the location to it.
This is just a sample code, just change it to how you need it. You will have to ensure that the controls get added back when a postback takes place.Last modified: 16mins after originally posted --
|
|
|
|
|
Thank you, and I am glad your willing to help such a newb like myself, but believe me, I am trying to help myself at the same time. Thanks for links to articles on this, will most definately read. I found some good help in my Visual C# .Net book as well.
|
|
|
|
|
Both links went to code project
|
|
|
|
|
Sorry. I Have changed it now, have a look.
|
|
|
|
|
This is going to be great for my upload on my main form that they upload on, but for the page I am doing this on, its just to view, they will not be allowed to upload any files, just vewing files attached to a helpdesk record.
|
|
|
|
|
Just pass the string to the required page or store it and retrieve it from some location and do the same thing.
|
|
|
|
|
I am trying to write a dataset upon login and write certain information retrieved from an Access db (I hate Access but right now the SQL box isn't available so I'm hitting the Access db as little as possible). When I populate the DataSet and use DataSet.WriteXML it's giving weird results. Also, when I login in a 2nd time (with a different user, the only part that works is searching the XML for the user I'm logging in with if it exists then dont rewrite it) I want it to append it to the existing XML document and even this isn't working right, the .WriteXML is giving a result like
<newdataset>
<Table>
<_x0027_u_name_x0027_>rlmccutchen<_x0027_u_name_x0027_>
<_x0027_u_pwd_x0027_>*********<_x0027_u_pwd_x0027_>
<_x0027_f_name_x0027_>Richard<_x0027_f_name_x0027_>
<_x0027_l_name_x0027_>McCutchen<_x0027_l_name_x0027_>
<_x0027_email_x0027_>richard@psychocoder.net<_x0027_email_x0027_>
<_x0027_is_admin_x0027_>1<_x0027_is_admin_x0027_>
<_x0027_total_posts_x0027_>0<_x0027_total_posts_x0027_>
<_x0027_client_id_x0027_>1<_x0027_client_id_x0027_>
<_x0027_user_id_x0027_>1<_x0027_user_id_x0027_>
<_x0027_site_name_x0027_>RamEngine<_x0027_site_name_x0027_>
</Table>
</newdataset>
<newdataset>
<Table>
<_x0027_u_name_x0027_>jbunton<_x0027_u_name_x0027_>
<_x0027_u_pwd_x0027_>*********<_x0027_u_pwd_x0027_>
<_x0027_f_name_x0027_>Jack<_x0027_f_name_x0027_>
<_x0027_l_name_x0027_>Bunton<_x0027_l_name_x0027_>
<_x0027_email_x0027_>ramremfg@aol.com<_x0027_email_x0027_>
<_x0027_is_admin_x0027_>0<_x0027_is_admin_x0027_>
<_x0027_total_posts_x0027_>0<_x0027_total_posts_x0027_>
<_x0027_client_id_x0027_>1<_x0027_client_id_x0027_>
< _x0027_user_id_x0027_>2<_x0027_user_id_x0027_>
<_x0027_site_name_x0027_>RamEngine<_x0027_site_name_x0027_>
</Table>
</newdataset>
I've been raking my head for days now trying to solve this so I canh move on to a new piece. Can someone please help.
" In the next millennium there are two kinds of business, those on the Internet and those out of business"
Bill Gates
"Be nice to nerds. Chances are you'll end up working for one."
Bill Gates
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
RLMcCutchen wrote: When I populate the DataSet and use DataSet.WriteXML it's giving weird results.
Like what?
RLMcCutchen wrote: Also, when I login in a 2nd time (with a different user, the only part that works is searching the XML for the user I'm logging in with if it exists then dont rewrite it) I want it to append it to the existing XML document and even this isn't working right, the .WriteXML is giving a result like
Are you using a stream or directly writing it into a file? Looks like you are opening a filestream writing the file and opening the file again and appending the 2nd user's data, in this scenario the xml will get appended to the previous xml in the file.
If you post the code you are using, then we could find out the problem.
|
|
|
|
|
Tarakeshwar Reddy wrote: RLMcCutchen wrote:
When I populate the DataSet and use DataSet.WriteXML it's giving weird results.
Like what?
The weird results are the XML I posted in the original post. The column names arent what they are coming from the database. Granted I dont do a lot of work with XML and I've spent some time researching it but I feel like I'm beating my head against the wall. Once I get home I'll post the code but right now I'm at work and dont have access to my home development machine.
Part 2
I do want the XML appended but the way its doing it its adding a 2nd root element which cant happen so I'm trying to figure out how to add the other users as they login without adding multiple root level elements.
" In the next millennium there are two kinds of business, those on the Internet and those out of business"
Bill Gates
"Be nice to nerds. Chances are you'll end up working for one."
Bill Gates
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
RLMcCutchen wrote: I do want the XML appended but the way its doing it its adding a 2nd root element which cant happen so I'm trying to figure out how to add the other users as they login without adding multiple root level elements.
How are you adding the users? From your code I presume that you have a dataset which would already contain the details of the first user, if you add a new row to the dataset and fill it with the required details and then do a writexml you should be having an xml file with a single root element and both the users details inside it. Looks like the logic your using is different from the one I have mentioned and thats why your getting multiple root elements.
Once you get back home, you can post the code and we could find out the issue.
|
|
|
|
|
I have no problem while coding ASP.Net page but when it comes to create an attractive page in terms of look and feel ( i am a failed man). I donot know how we can graphically design a web page in visual studio 2005(ASP.Net). For e.g. i have 3 images; how can i shown these pages in the head,middle and foot of a ASP.Net page.
Also,please provide some good links for grahically desiging a ASP.Net page if possible.
X
|
|
|
|
|
My name is Jatinder and I work for Microsoft on the TechEd event. I generally read IT blogs to keep up with what is going on in the industry and decided to jump on in with a little plug for TechEd 2007 (June 4 – 8). This year we’ve dedicated 50% of the event content to developer specific tools with deep technical training that covers Visual Studio® 2005, Windows Vista™ development and the .NET Framework. You can also get in-depth information on building software using Visual C++®, Visual Basic® and Visual C#®. The incredible amount of information you can learn at TechEd is awesome but it is also an incredible place to network and let loose a little. The event is in Orlando, FL this year so the attendee party is at Universal Studios Islands of Adventure and the place is reserved for TechEd attendees only! Trust me, these parties are a blast. If you decide to go you should register now before it sells out like it did last year…we are also offering a bit of an incentive, all registrations before May 11th are entered to win either 1 of 5 Xbox 360 Elites (killer graphics) or 1 of 5 Amex gift cards (Disney ain’t cheap!) www.microsoft.com/teched
Jatinder Singh
|
|
|
|
|
Whats wrong with you? This is the 4th time your posting this message. I am sure Microsoft doesn't have people who spam the forums like this. Kyle please stop this
|
|
|
|
|
i have created a number of combo boxes according to my need.no i want to save the changes when any one click update button,but here the control did not find by findcontrol function.
Dim i, j, totc As Long, FcNo As String, cmbcat As Object, fid As ArrayList
catarry = New ArrayList
catarry = CType(ViewState("catgs"), ArrayList)
totc = CLng(ViewState("totcts"))
For i = 0 To totc - 1
'for category combo box
'cmbcat = New Object
'cmbcat = CType(Me.FindControl("catpp" & catarry(i * 3 + 1)), DropDownList)
'cmbcat = CType(Me.FindControl("catpp" & catarry(i * 3 + 1)), DropDownList)
'cmbcat = CType(Me.FindControl("catpp" & catarry(i * 3 + 1)), DropDownList)
If Not CType(Me.FindControl("catpp" & catarry(i * 3 + 1)), DropDownList) Is Nothing Then
FcNo = CType(Me.FindControl("catpp" & catarry(i * 3 + 1)), DropDownList).Text
End If
StrQry = "update category set cat_order=" & FcNo & " where cat_no=" & "catpp" & catarry(i * 3 + 1)
'Now check for all forums of category
fid = New ArrayList
fid = AllFunctions.PopToarraylist("select Forum_No from Forum where cat_no=" & catarry(i * 3 + 1), 1)
For j = 0 To fid.Count - 1
cmbcat = New Object
'cmbcat = CType(FindControl("frmpp" & fid(i)), DropDownList)
'cmbcat = CType(FindControl("frmpp" & fid(i)), DropDownList)
'cmbcat = CType(FindControl("frmpp" & fid(i)), DropDownList)
If Not CType(Me.FindControl("frmpp" & fid(i)), DropDownList) Is Nothing Then
FcNo = CType(FindControl("frmpp" & fid(i)), DropDownList).Text
End If
'cmbcat.Text
StrQry = "update Forum set Forum_Order=" & FcNo & " where forum_no=" & fid(i)
AllFunctions.UpdateQry(StrQry)
Next
Next
|
|
|
|
|
I am using a GridView and i connected it to an SqlDataSource to display data, but the data i want to display is from multiple tables and the GridView lets u select data just from one table, How can i solve this porblem.
Thanx in advance for ur help
yasso
|
|
|
|
|
You would need to query the data together. Why are arent you just specifying your datasource in your webconfig file, loading the datasource, and then querying out what you need with a SQL statement?
|
|
|
|
|
I have a textbox that should be validated thats on a webcontrol.
The webcontrol is on a step in a wizard control.
When I click the next button the validation for the textbox does not fire.
Is there a way to make the validation just for the webcontrol on the step in focus fire ?
|
|
|
|
|
Hi friends
I have one string str="aaaa,bbbb,cccc,dddd,eeee,ddddd";
I want to count char "," from the above string
plz any one help me
thanks in advance
pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|