|
|
I have a datagrid with various BoundColumns and HyperLinkColumns.
All of the columns work great. The problem is that I am creating a list for data entry. If the data has already been entered I want to disable the Entry Hyperlink and Enable the View/Edit Hyperlink, and visa versa if the entry has not been made I want the Entry HyperLink to be Enabled and the View/Edit HyperLink to be Disabled. If there was a way to create an ID for the column I could handle it in the ItemDataBound Event in the behind code, but I have not found a way to create an ID field for the HyperLinkColumn. Could someone assist with a code sample for ASP.NET...
|
|
|
|
|
It could be done easily using this :
.disabledLink
{
color: #333;
text-decoration : none;
cursor: default;
}
Use this Javascript to do this in client side.
function disablelink(linkID)
{
var hlink = document.getElementById(linkID);
if(!hlink)
return;
hlink.href = "#";
hlink.className = "disableLink";
}
or in ItemDataBound use :
ctrl.CssClass = "disabledLink";
ctrl.Href = "#";
It will be disabled.
Why do you require to create ID. If you place the server side ID, you might use ClientId to get what id is generated in the client.
|
|
|
|
|
protected void gvPaymentDetails_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
GridViewRow gvr = e.Row;
if (gvr.Cells[5].Text != " " || gvr.Cells[6].Text != " " || gvr.Cells[8].Text != "0")
{
((LinkButton)(e.Row.FindControl("lbEdit"))).Enabled = false;
((LinkButton)(e.Row.FindControl("lbEntry"))).Enabled = True;
}
else
{
((LinkButton)(e.Row.FindControl("lbEdit"))).Enabled = True;
((LinkButton)(e.Row.FindControl("lbEntry"))).Enabled =False;
}
}
}
I am using this code in my appliction for edit and add button.
|
|
|
|
|
Will ASP.NEt treat the LinkButton the same as the HyperlinkColumn with all of the same properties like DataNavigateUrlField and DataNavigateUrlFormatString?
|
|
|
|
|
i think it will work in hyperlink columns 2 but why dont u use this code
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="lnkEdit" runat="server">Edit</asp:LinkButton>
<asp:LinkButton ID="lnkView" runat="server">View</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
use itemtemplate for hyperlinks
|
|
|
|
|
Where do you handle the actual navigational link and column header information?
|
|
|
|
|
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lbEdit" runat="server" Text="Edit" OnClick="lbEdit_Click"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
i am redirecting from aspx only.
LinkButton btn = sender as LinkButton;
GridViewRow gvr = btn.NamingContainer as GridViewRow;
string docNo = gvr.Cells[0].Text;
so this way i am fetching row datakey
|
|
|
|
|
Wouldn't you have to handle that in the Code Behind...
My predecessor developed this is VB
|
|
|
|
|
I like the looks of this implementation except that it feel like a total rewrite of the ASP page because the page binds data to both BoundColumns and HyperLinkColumns.
To date I have not attempted to bind data to a LinkButton. Is this possible? or would I Have to move all of the naturally bound data to the ItemDataBound method and then launch the enbedded JavaScript from the ItemCommand method?
|
|
|
|
|
plz send me your code so it'll be more clear.
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hi All,
1)My application is working fine. When i enter the account number in Textbox only. If i use the Querystring in url along the account number, then i am getting the Javascript Error and UI of the Page also scrumbled.
Ex:QueryString--> Default.aspx?account=123212
Please suggest me,Is i am missing while the passing the value in
"QueryString", to over come with Javascript Error.
2)The Javascript Error was "Missing the Character" such as ";", but nothing missing as per code.. It come only when i was the value through querystring.
Thanks in Advance...
JohnDas
|
|
|
|
|
put your exact code and write what you want exactly with query string.
Regards
Keyur Satyadev
|
|
|
|
|
Where are you passing the query string and how are you passing the querystring? Is there any javascript available? Please provide code...
Naina
|
|
|
|
|
string accountno="12345";
or
int accountno=12345;
"Default.aspx?account=" + accountno
|
|
|
|
|
Johndas wrote: Please suggest me,Is i am missing while the passing the value in
Are you doing it using JavaScript or From Codebehind ?
If you are doing it from Server Side Code Behind Try This :
string accountId="123";
Response.Redirect("Default2.aspx?AccountID=" + accountId);
Or If you still getting the error 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.
|
|
|
|
|
Hi all,
i am new to ajax.I know the basic use of update panel.
But my problem is
I have to 2 update in first update i want to add value to the database.after insertion sucessful.
i want to show these value in dropdown which is in panel 2.
and second update panel is in different column
Thanks and regards,
Amit Patel
|
|
|
|
|
go through below. all your queries will remove.
http://www.asp.net/learn/ajax/
Regards
Keyur Satyadev
|
|
|
|
|
Set the update panel mode to conditional and use updatepanelid.update()
One person's data is another person's program.
--J.Walia
|
|
|
|
|
Dear All,
i have developed a web application in vs2005 and i have to update it. now i am working in vs2008. so can i open it and change it in this new version of vs. if yes then what changes i have to do in web.config file.
(i used ajax extension in vs2005.)
before posting this thread i tried to do same but the ajax extension is not working properly in internet explorer and also gives script error and the web.config file also get changes when i deployed it.
please reply me..
Thanks!
|
|
|
|
|
Go to this link and download the latest toolkit for vs2008:
http://ajaxcontroltoolkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33804
One person's data is another person's program.
--J.Walia
|
|
|
|
|
m trying to export crystal report to PDF using parameters..
Please suggest a good link from which i can get the code..
Sharing Of Knowledge Provides Solution....
|
|
|
|
|
I Have a string
<Parameters>
<UserProfileState>0</UserProfileState>
<Parameter>
<Name>Report_Parameter_0</Name>
<Type>String</Type>
<Nullable>False</Nullable>
<AllowBlank>True</AllowBlank>
<MultiValue>False</MultiValue>
<UsedInQuery>False</UsedInQuery>
<State>MissingValidValue</State>
<Prompt>Report_Parameter_0</Prompt>
<DynamicPrompt>False</DynamicPrompt>
<PromptUser>True</PromptUser> </Parameter>
<Parameter> <Name>Report_Parameter_1</Name>
<Type>String</Type> <Nullable>False</Nullable>
<AllowBlank>True</AllowBlank>
<MultiValue>False</MultiValue>
<UsedInQuery>False</UsedInQuery>
<State>MissingValidValue</State>
<Prompt>Report_Parameter_1</Prompt>
<DynamicPrompt>False</DynamicPrompt>
<PromptUser>True</PromptUser>
</Parameter> </Parameters>
I want to do string manipulation with this and i want to get the value of
<Name>Report_Parameter_0</Name>
they are 2 <Name>
its not xml ..!
how to do in good method.!
any help is greatly appreciated..!
|
|
|
|
|
Please do not cross post.
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...!!
|
|
|
|
|
What A discovery Columbus..!
In Different Forum..!
|
|
|
|