|
let me how could i code for gridview ?
Give me 5 examples of it?
mslamba
|
|
|
|
|
|
So I added a hidden filed
<asp:HiddenField ID="CategoryID" runat="server" />
I get the form method to POST.
But on the next page it says the form collection doesn't have any objects.
Is there a special setting to get it to work?
I'm using VS2005
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
Ista wrote: But on the next page it says the form collection doesn't have any objects.
Nick, you mean you are using the cross-page posting and on the next page you cannot see the hidden field in the Form collection? Could you be more specific with your sample code?
|
|
|
|
|
actually no.
I am making a forum that has categoryID's, topic'ID, and entryID's
I have 2 hidden Input fields on form 1.
on the topic page I have 2 input fields. One contains the categoryID and topicID.
when I go to the final page, lets say form 2. I want to do this
string catID = Request.Form["CatgeoryID"];
string topicID = Request.Form["TopicID"];
thats all I want to do.
This works fine in VS2003, but I can't get it to work on VS2005.
thanks for helping,
nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
Actually yes. I was 5 pages away from it in my book.
But I have a problem. I have the next page set up for the cross posting.
But on the previous page I have a hyperlink column inside my GridView. I need to attach a PostBackUrl property to it.
I need these to look like hyperlinks( meaning appear as text of the screen )
How do you suggest I do that?
thanks
nick
1 line of code equals many bugs. So don't write any!!
-- modified at 22:54 Thursday 27th April, 2006
|
|
|
|
|
You may use the TemplateField with the LinkButton whose PostBackUrl property specifies the Url of the next page. For more information, you can see MSDN[^].
|
|
|
|
|
I have a data list with a Web User Control
this WUC has an ImageButton inside it.
WHen i click it I get the following error:
Invalid postback or callback argument. Event validation is enabled using <pages enableeventvalidation="true"> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
DO I call this on the Main Page?
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
|
Does anyone have tips or hard-earned wisdom with regards to writing a .NET Web Service which is intended to be used by a Java application? Are there any things that I should keep in mind about things such as:
1) SOAP formats
2) ref or out parameters
3) SOAP deserialization quirks found in the Java platform
4) Things I have not thought to list...
I've given this topic some due diligence (a.k.a. Google) but am hoping someone has nuggets of wisdom that I didn't find yet.
Thanks for any help,
Josh
|
|
|
|
|
hello,
if i want the button click event to fire on the enter key press how do i do it?
Uma
|
|
|
|
|
You can create an event handler for the onkeypress event of the body, capture the Enter with keyCode=13 , then call the click method of the button. In the ASP.NET 2.0, there's a nice feature, the HtmlForm.DefaultButton property, which you can specify which button will be fired when the Enter is pressed.
|
|
|
|
|
I have a question regarding NT Authentication. Currently I have my setup on NT authentication, however, I would like the application to gather credentials and not ask for login name everysingle time.
I have made the proper modifications in IIS. But i get that prompt everytime i get to that secure part of my application. ( User Password Domain)
Is this possible to have this authentication and not prompt for password at all?
My app is ASP.NET with C# code behind.
|
|
|
|
|
What browser are you using for testing? In fact, when you use the Windows authentication, your ASP.NET application relies on the authentication of the IIS, and if the browser can, it will automatically send the logon account to the IIS for the authentication. You need to check the documentation of the browser that you are using, for example with IE you can check the Security Settings (in the User Authentication section). FF by default does not send the user account to the server, and you can config the URI of your application as a trusted URI in the preferences file.
|
|
|
|
|
private void Page_Load(object sender, System.EventArgs e)
{
string nt_User,name;
nt_User = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
name = nt_User.Remove(0,7);
this.lblUser.Text = name;
if(name == "david" || name== "tom")
Response.Redirect("Management.aspx");
if(!IsPostBack)
BindData();
}
This is the code I am using. Does it seem like my problem is in the code or possible in IIS?
Thanks
Explorer Version 6.0
|
|
|
|
|
Hi,
I am developing an Web Application in ASP.Net with C#. In this application I have used the IsApiRewrite tool for Rewriting the URL. I have got a page named Images and this page has got a dropdownlist. When the dropdown list is autopostbacked then the original URL gets appended to the Rewritten URL. Not only that any WebControl on that page is not calling its handler function .Instead the original URL gets appended to the Rewritten URL. What i want is that when the dropdown list is autopostback then the Rewritten URL should appear in the browser. Kindly help me out in solving this problem.
Rewritten URL :http://localhost/Entertainment/Harr...s/Images/1.html
Actual Url: /Images.aspx?Category=Harry%20Potter%20Movies&id=1
After Selecting a new Item in Drop down list i get the URL as:
http://localhost/Entertainment/Harr...ter+Movies&id=1
The Rewriting Rule is: RewriteRule (.*)/(.*)/(.*)/Images/([\w-]+).html $1/Images.aspx?Category=$3&id=$4 [L]
Please Help me out.
Thanks.
Irshad Ahmad
|
|
|
|
|
Hi
I'm trying to do file listings on separate folders and display it on a datagrid. However, for some reasons the sorting is not working. Below is my code. Can anyone help? thank you
Sub createDataSource()
Dim DV As DataView
Dim DS As New DataSet
Dim DT As New DataTable
Dim DR As DataRow
DT.Columns.Add("Category", GetType(String))
DT.Columns.Add("Filename", GetType(String))
Dim DirInfo1 As DirectoryInfo
Dim FileInfos1() As FileInfo
Dim Fi1 As FileInfo
Dim DirInfo2 As DirectoryInfo
Dim FileInfos2() As FileInfo
Dim Fi2 As FileInfo
'-----------------------------
DirInfo1 = New DirectoryInfo("C:\TEMP\")
FileInfos1 = DirInfo1.GetFiles("*.*")
For Each Fi1 In FileInfos1
DR = DT.NewRow()
DR(0) = "Guide"
DR(1) = "" & Fi1.Name.ToString & ""
DT.Rows.Add(DR)
Next
'-----------------------------
DirInfo2 = New DirectoryInfo("c:\temp\forms_radsql\")
FileInfos2 = DirInfo2.GetFiles("*.*")
For Each Fi2 In FileInfos2
DR = DT.NewRow()
DR(0) = "Guide"
DR(1) = Fi2.Name.ToString
DT.Rows.Add(DR)
Next
DS.Tables.Add(DT)
DV = New DataView(DS.Tables(0))
DV.Sort = "Filename ASC"
Me.DataGrid1.DataSource = DV
Me.DataGrid1.DataBind()
End Sub
|
|
|
|
|
|
|
I have tried combinations of the following to cancel the postback of a ButtonField. I am obtaining the data to view via Ajax and do not want the postback. Any ideas?
Code Behind in the dgData.RowDataBound event:
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes.Add("onclick", "javascript:return viewRow(" & CType(e.Row.DataItem, BusinessObjects.Course).CourseID.ToString & ",this);")
End If Or without the "return"
e.Row.Attributes.Add("onclick", "javascript:viewRow(" & CType(e.Row.DataItem, BusinessObjects.Course).CourseID.ToString & ",this);") HTML:
<asp:ButtonField Visible="true" ImageUrl="../images/ViewSearch.gif" ButtonType="Image" Text="View Record" >
<ItemStyle HorizontalAlign="Center" Width="20px" />
</asp:ButtonField> JavaScript
function viewRow(id, row) {
try {
if (!(previousRow==null)) previousRow.backcolor= row.backcolor;
previousRow = row;
row.style.background="lightblue";
document.getElementById("<%=tblEdit.ClientID %>").style.display="none";
document.getElementById("<%=tblView.ClientID %>").style.display="inline";
requestSimpleService = CourseList.GetCourse(id, populateCourse, onError);
return true;
} catch (e) { alert(e.message);
}
} Note I am using the "<%=tblView.ClientID %>" due to using masterpages.
Thanks,
Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious.
Vince Lombardi (1913-1970)
|
|
|
|
|
Hi Michael,
You need to add the onlick attribute to the ImageButton (the ButtonField with the ButtonType="Image" ) instead of the the row (tr) element. So there are two ways here to cancel the postback of the ButtonField:
+ Get reference to the ImageButton which is automatically added to the cell:
if (e.Row.RowType == DataControlRowType.DataRow)
{
ImageButton btn = e.Row.Cells[cellIndex].Controls[0] as ImageButton;
if(btn != null)
btn.On_Client_Click = "clientsidefunction(); return false;";
} + Use the TemplateField with the ImageButton in the ItemTemplate instead of the ButtonField:
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton On_Client_Click="clientsidefunction(); return false;" ... />
</ItemTemplate>
</asp:TemplateField>
|
|
|
|
|
Like this: (replace the X in cells(X) with the correct column number for you case)
Private Sub DataGrid1_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemCreated
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim c As Button = e.Item.Cells(X).Controls(0)
c.Attributes.Add("onclick", "return confirm('Do you really want to click this?')")
End If
End Sub
cheers
P
|
|
|
|
|
I m using a Pivot table and a chart in my asp.net 2.0(C#) application. I want to edit data in Pivot table and save in the sql database.
Is there any way of doing it?
|
|
|
|
|
What data do you want to save? Surely the data displayed in a pivot table is aggregated...
If you change the underlying data, I'm sure you can save it, but the answer to your question depends very much on how you are supplying the data to your pivot table - it's really just a matter of creating an update sql statement for anything that changes...
|
|
|
|
|
I saw one example of how to display Pivot Table
protected PivotTableClass pt;
pt = new PivotTableClass();
pt.ConnectionString ="Provider=SQLOLEDB.1;Data Source=AHD-2003;database=northwind;user id=sa;password=;";
pt.DataMember ="select * from suppliers";
pt.ShowDetails();
I m using OWC10. But there is no method named ShowDetails(). How can it be?
Do u have any example of how to display Pivot table programmatically.
|
|
|
|