|
Hi,
I got this error when I define
Dim htmlwrite As System.Web.UI.HtmlTextWriter
htmlwrite = System.Web.UI.HtmlTextWriter.Null
in the ASP.net code behind.
But if I take the second line out, it gives me another error message "Object not defined"
Basically I just want to open Excel file from ASP page or be able to open Excel page from Explorer. It works fine in ASP, but not working in ASP.NET.
Anyone can help?
Thanks advanced
Dina
Dina
|
|
|
|
|
why would you set it to null?
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
Ista,
Thanks for advise. I resolve the problem. I take the line that sets to null and move to the if statement, now the error is gone.
Dina
Dina
|
|
|
|
|
after this line
Dim htmlwrite As System.Web.UI.HtmlTextWriter
will be htmlwriter null, so you don't need to set it to null again.
Pilo
|
|
|
|
|
HI , i added a checkbox into my datagrid & i want when checking this latest to select the row this latest belong to
well , i don't want you askme why i want this feature ? i just need it i thaught a lot about an other solution , if you have one tell me
thank you
try to be good if you can't be the best
|
|
|
|
|
check the sender object
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
hey, howare you ?
i tried the sender object but it didn't work , i really need now to know the control that caused the postback ,because i needed it in some other things
try to be good if you can't be the best
|
|
|
|
|
You have to make a loop in which u have to check all the checkboxes in grid row by row.
You can write this code in CheckedChanged event.
Do good and have good.
|
|
|
|
|
I'm using a data bound Gridview and added two dropdown list using TemplateField say country and state. I need to fill the state dropdownlist with respect to the country(ddl) selected.
I tried to to fire the selectedindexchanged event of Gridview by addid the below in GridView1_RowDataBound
e.Row.Attributes.Add("onMouseOver",
"this.style.cursor='hand';");
e.Row.Attributes.Add("onclick",
this.GetPostBackClientEvent(GridView1,
"Select$" + e.Row.RowIndex.ToString()));
But before I click the dropdownlist the selectindexchanged get executed.
How do i achieve that..
Hope for help at the earlist
Thanks in advance
Vijoo
|
|
|
|
|
|
I looked at the custom provider and it seems like a good fit for what I need to do with some modifications. I guess if I explained what I am trying to do then it might be easier to steer me in the direction I need to go.
The main system has different modules and people can have access to one or many modules.
John Doe has access to:
Property Management (Module 1) - 'User' role
- View Properties
Customers (Module 2) - 'Admin' role
- Add New Customer
- Reports
Future Modules, etc.
John has access to module 1 and is in 'User' role. User role is restricted to certain pages, etc.
John has access to Module 2 and is in 'Admin' role. Admin role can view all.
When John logs in, 2 tabs are shown, Property Management and Customers. When he clicks on an item, sub navigation is shown based on his role.
Essentially the application needs to scale out to however many modules are needed and top-level navigation (module) needs to be built on the fly based on users access level.
What would be the best approach to this scenario? Have the navigation (modules and subsequent pages) all pulled from the database or would a mix of database and web.config in folders work better?
All the examples that I have seen have been relatively simple and none that I have seen deal with more complex situations like I described. Any thoughts or ideas would be GREATLY appreciated.
Thanks in advance
|
|
|
|
|
Using SiteMap and the built in Menu control in .NET 2.0 you can put a "Roles=" option in the SiteMap that only has those nodes show up in the menu control if the user is in one of the listed Roles (and IIRC, if you don't list roles they are viewable to all).
|
|
|
|
|
how do you have pages in sitemap.xml file that dont show on navigation structure?
|
|
|
|
|
Hi,
I am trying to sort out creating dynamically created buttons.
For example, i have an input button (HtmlInputSubmit) on my page. This has onserverclick="click1" say.
click1 will then dynamically create another HtmlInputSubmit button, e.g.:
HtmlInputSubmit b = new HtmlInputSubmit();
b.Value = "mmm";
b.ID = "testID";
b.Load += new EventHandler(click2);
b.ServerClick += new EventHandler(click2);
click2 would then do something (e.g. change this new HtmlInputSubmit button's text. I would only use either b.Load or b.ServerClick.
My problem is that if i use b.ServerClick, run the page, when i click on the dynamically created button with text "mmm" the page reloads and the button disappears without calling the click2 method. If i use b.Load click2 gets called when i click on the original button to create the new button, so it gets created with text "new text".
Am i right in thinking that the button is disappearing because of something to do with the viewstate? I want to be able to assign this new button an onclick(onserverclick) event, but at the moment i can't because it keeps disppearing if i click it.
Can anyone help?
Thanks.
|
|
|
|
|
Please refer to the following link. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/viewstate.asp[^]
Scroll down to View State and Dynamically Added Controls
Good luck.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
I think i get it. I have to create my dynamic controls at page_init for them to be remembered?
|
|
|
|
|
Actually i think i understand it better now. I have managed to create a button dynmaically in Page_Init and that button then calls my other onclick method. I cannot ever have a button that creates another button though which calls my other onclick method because everytime the page reloads on that click the button will be removed?
|
|
|
|
|
Exactly, you'd have to add an event handler on every page init. I think you're getting it.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
I am using c# and asp.net. I have some text boxes,listboxes and a datagrid. when i press "Add" button i nne the vales and the text in the textboxes and the listboxes shold display in the grid witout sending to database. when i press "Save" the rows in the grid should be updated in the database.
Helpme please...
Sunil
|
|
|
|
|
What you need to do is save the DataTable in the viewstate and rebind the grid after the save button is clicked.
I have a user control I wrote that does this so here is some sample code. It starts off with an empty grid. Below is the method that creates the initial datatable and stores it in view state.
<br />
void intiGrid()<br />
{<br />
DataTable dt = new DataTable();<br />
DataColumn c = new DataColumn();<br />
c.ColumnName = "ClassCode";<br />
c.DataType = System.Type.GetType("System.String");<br />
dt.Columns.Add(c);<br />
<br />
<br />
c = new DataColumn();<br />
c.ColumnName = "Required";<br />
c.DataType = System.Type.GetType("System.Boolean");<br />
dt.Columns.Add(c);<br />
<br />
c = new DataColumn();<br />
c.ColumnName = "ClassDesc";<br />
c.DataType = System.Type.GetType("System.String");<br />
dt.Columns.Add(c);<br />
DataRow row;<br />
row = dt.NewRow();<br />
row[0] = "New";<br />
row[1] = true;<br />
row[2] = "";<br />
dt.Rows.Add(row);<br />
<br />
DataColumn[] columns = new DataColumn[1];<br />
columns[0] = dt.Columns["ClassCode"];<br />
dt.PrimaryKey = columns;<br />
<br />
this.GVRequiredClassCodes.DataSource = dt;<br />
this.GVRequiredClassCodes.DataBind();<br />
ViewState[this.ClientID.ToString() + "DataTable"] = dt;<br />
}<br />
This next snippet is how I add a new row to the grid.
<br />
DataTable DT = new DataTable();<br />
DT = (DataTable) ViewState[this.ClientID.ToString() + "DataTable"];<br />
DataView DV = new DataView(DT);<br />
DV.Sort = "ClassCode";<br />
<br />
DataRow R;<br />
R = DT.NewRow();<br />
R[0] = sNewClassCode;<br />
R[1] = cb.Checked;<br />
R[2] = classDescription;<br />
DT.Rows.Add(R);<br />
this.GVRequiredClassCodes.DataSource = DV;<br />
this.GVRequiredClassCodes.DataBind();<br />
ViewState[this.ClientID.ToString() + "DataTable"] = DV.ToTable();<br />
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
I'm writing an asp.net application which will have at least 30 pages that need to be created for editing business objects which I'm porting from a winform app.
They all have a consistent menu so I thought I would put it into a master page and put the different bits in content pages, however from what I can see if I have a save option (for example) on my master page menu, there is no way when a user clicks on it to send that event to the content page for processing.
|
|
|
|
|
You have access to the content page through the ContentPlaceHolder.Page property. From that you could call a Save method on the page.
only two letters away from being an asset
|
|
|
|
|
Yes you can do so. Add an event handler to the page init
Here is the vb.net if you need c# let me know I'll try to convert.
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init<br />
'FInd the control in your master page and add the event handler<br />
Dim ddl As DropDownList<br />
ddl = CType(Me.Master.FindControl("ddlStates"), DropDownList)<br />
AddHandler ddl.SelectedIndexChanged, AddressOf ddlStates_SelectedIndexChanged<br />
<br />
'ddlState_SelectedIndexChanged <br />
<br />
end sub<br />
<br />
'Method called on post back after user click<br />
Protected Sub ddlStates_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)<br />
'Code to fire from master page event<br />
end sub<br />
-- modified at 12:17 Thursday 27th July, 2006
|
|
|
|
|
Yeah that's it! I extended it into a generic message with object parameter event so I could handle all manner of clicks and various events from the master page.
thanks
|
|
|
|
|
Another option in my humble opinion is that you can define a public event in the Master page, say Save, then any content page would want to handle this event should subscribe it.
|
|
|
|