|
I have a gridview in which in every row i have a button .When i click that
button i want to perform some task.This button is in third column the second column has the name of the file . i want that name of that file which is there in that row. Actually i want to know what is the event and how to capture it .
thanks
|
|
|
|
|
U can capture Row Command event for the same.
|
|
|
|
|
can you help me out with the code.
thanks
|
|
|
|
|
Tyr this:
Protected Sub grdCommunicationDetailsView_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles grdCommunicationDetailsView.RowCommand
Try
gridROW = CType(CType(e.CommandSource, Control).NamingContainer, GridViewRow)
ml_lngCommunicationID = CInt(grdCommunicationDetailsView.DataKeys(gridROW.RowIndex).Value)
htxtCommunicationID.Value = ml_lngCommunicationID
Select Case e.CommandName
Case "DeleteTrans"
objTAXCommunicationDetails = New CTAXCommunicationDetails
With objTAXCommunicationDetails
.FormId = msForm_TYPE.msForm_TAXCOMMUNICATIONDETAILS
.CommunicationID = ml_lngCommunicationID
.UserId = Session("UserId")
.Delete()
End With
strMessage = "Record Deleted Successfully...!"
RefreshGridView()
End Select
Catch ex As Exception
End Try
End Sub
<asp:GridView>
<Columns>
<asp:TemplateField HeaderStyle-CssClass="heading" HeaderText="Delete">
<ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
<ItemTemplate>
<asp:ImageButton ID="Delete" runat="server" CommandName="DeleteTrans" ImageUrl="../Images/delete.gif" CssClass="cursor"
ToolTip="Delete" />
</ItemTemplate>
<HeaderStyle Width="60px" />
</asp:TemplateField>
</Columns>
</asp:GridView>
Any problem let me know.
|
|
|
|
|
hi ritu
try this code:-
Set commandname and CommandArgument property of Button
<asp:Button ID="BT" runat="server" Text="Button" CommandName="Botton" CommandArgument='<%# Eval("fileid") %>'/>
protected void GV_items_RowCommand(object sender, GridViewCommandEventArgs e)
{
string fileid = Convert.ToString(e.CommandArgument);
//By this code u will get ur fileid
}
pathan
|
|
|
|
|
we cannot take button in gridview in this way. IT gives error .
Error 1 System.Web.UI.WebControls.DataControlFieldCollection must have items of type 'System.Web.UI.WebControls.DataControlField'.'asp:Button' is of type 'System.Web.UI.WebControls.Button'.
|
|
|
|
|
Try the code which I gave as I am doing this only and its working in my Project. The only difference is that I am using image button and u r using button.
|
|
|
|
|
Hi ritu
u can take server bottun between <ItemTemplate> tag.
i give u whole code how to take a button
now try this code
<asp:GridView ID="GV_cart" runat="server" AutoGenerateColumns="False"
OnRowCommand="GV_cart_RowCommand" CellPadding="4" ForeColor="#333333">
<Columns>
<asp:BoundField DataField="fileid" HeaderText="File Id" />
<asp:BoundField DataField="Filename" HeaderText="File Name" />
<asp:TemplateField>
<HeaderTemplate>File id</HeaderTemplate>
<ItemTemplate>
<asp:Button ID="BT" runat="server" CommandName="button" CommandArgument='<%#Eval("fileid") %>' Text="Button" Width="75px" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
After this write code on Row_command event
if (e.CommandName == "button")
{
string fileid= e.CommandArgument.ToString();
}
if u use more than one button than this code may be useful for checking which button evet fires by commandname condition.
Pathan
|
|
|
|
|
thanks . had worked .thanks to varsha mane too.
|
|
|
|
|
|
How to call webservice without adding webreference in solution
|
|
|
|
|
Web Method from Web Service can be invoked by using HTTP POST. so, you can submit the Form with POST to a particular web method..
The way we are using in our project. we generate a proxy class by using wsdl. and just add this proxy class to web project. then, we can invoke to the webmethod via this proxy class..
here is also another way to invoke a web service without web reference.
http://www.codeproject.com/cs/webservices/CallWebServicesDynamic.asp
Hope it would help.
|
|
|
|
|
hi I am reading xls file in that there are 5 column of date in dd/mm/yyyy format but while i am reading from code few of date column format is change.
i.e mm/dd/yyyy how to fix this problem
|
|
|
|
|
Dear All,
I have made web application using Asp.net C#(Visual Studio2005). And I used Publish Web site option. Now I want to make web setup. I select New -> project -> SetUp and Deployement ->
There I given name of the setup and location of project file.When I click Ok. File System Web setup open. Now when i goes for add project output from web application project. I do not get any option
I even tried location of project to published web site location but it did not work out
Please help..
thanks
regards
imran khan
|
|
|
|
|
i am using xml to import data to my web page. Information is displaying but xsl style sheet is not applying please tell me, whats the problem .... Please my code is :
Dim xmlPath As String = Server.MapPath("XMLFile.xml")
Dim xslPath As String = Server.MapPath("XSLTFile.xsl")
Dim fs As FileStream = New FileStream(xmlPath, FileMode.Open,FileAccess.Read)
Dim reader As StreamReader = New StreamReader(fs, Encoding.UTF8)
Dim xmlReader As XmlTextReader = New XmlTextReader(reader)
'Instantiate the XPathDocument Class
Dim doc As XPathDocument = New XPathDocument(xmlReader)
'//Instantiate the XslTransform Class
Dim xslDoc As XslCompiledTransform = New XslCompiledTransform()
xslDoc.Load(xslPath)
Dim sw As StringWriter = New StringWriter()
xslDoc.Transform(doc, Nothing, sw)
' //Close Readers
reader.Close()
xmlReader.Close()
Response.Write(sw.ToString())
Please help me...
Feroze
|
|
|
|
|
Hi Feroze!
Why aren't you using the XML-Control (found in the Toolbox)?
With this you just need to apply the XML-Source and the transformation file.
e.g:
Dim xmlDoc As New XmlDocument()
xmlDoc.Load("your path to the xml-data goes here")
With yourXmlControl
.Document = xmlDoc
.TransformSource = "your path to the xsl-file goes here"
End with
This is all what needs to be done.
- walter
|
|
|
|
|
I am currently using a shared server with discount ASP.
I want to know if anyone of you have better experience in term of speed and efficiency with other webhosts.
please share your views
|
|
|
|
|
This site gives better performance and have much better features.
http://www.m6.net
|
|
|
|
|
|
|
Please give some details.
|
|
|
|
|
sorry about that.
i am developing a project that needs to store the encrypted admin password in a separate file (admin.xml). this file is located in wwwroot/project/bin/FILES/
this works fine until the user changes the password, in which case the password is saved in the "admin.xml" file.
after the file update, the session expires
i can't figure out why?
the password changing page is at the location wwwroot/project/GUI/chPassword.aspx
any suggestions?
thanks in advance.
|
|
|
|
|
I'd like to know whether it is possible to set different HeaderStyle for different columns in Gridview. I tried to put headerstyle cssclass tags in different columns. But this method is not working. Is there a way to do it?
Thank you so much in advanced
bin bin
|
|
|
|
|
i think this will work or you can also add it dynamically at ItemDataBound event.
< asp:BoundColumn HeaderText="Heading1" >
<HeaderStyle CssClass="class1"></HeaderStyle>
< /asp:BoundColumn >
Regards
Shajeel
|
|
|
|
|
Thanks for your reply.
It tried to define it in the asp:BoundColumn. But it seems the header style defined in the column won't override the style of the whole header. Should I use z-index to make it work?
The header style defined for column is not working at all.
Thank you again.
|
|
|
|